Skip to content

Instantly share code, notes, and snippets.

@MariusVanDerWijden
Created July 9, 2020 10:27
Show Gist options
  • Save MariusVanDerWijden/e36f493b23f1a72d2e7223fea7ee0485 to your computer and use it in GitHub Desktop.
Save MariusVanDerWijden/e36f493b23f1a72d2e7223fea7ee0485 to your computer and use it in GitHub Desktop.
tx, tx2, tx3 := new(types.Transaction), new(types.Transaction), new(types.Transaction)
// Send and abort both transactions
backend.SendTransaction(ctx, tx)
backend.SendTransaction(ctx, tx2)
backend.Rollback()
// Commits transaction to the chain
backend.SendTransaction(ctx, tx3)
backend.Commit()
// Use adjust time to test time-dependent functions
backend.AdjustTime(24 * time.Hour)
// Adjust time can only be called on an empty block and you need to call commit afterwards
backend.Commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment