aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-10-06 22:14:22 +0800
committerGitHub <noreply@github.com>2016-10-06 22:14:22 +0800
commit7335a70a020517cc9cebe7ae82c0e49ba133abf1 (patch)
treecc63625fa07bf3fb28326a01d5c8255a83a83bd1 /accounts
parent07caa3fccdfe11bbee084c043ac11e7cfae9a6b7 (diff)
parent3c836dd71b192de24774b1848173a4eb0ca9a63b (diff)
downloaddexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.gz
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.bz2
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.lz
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.xz
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.tar.zst
dexon-7335a70a020517cc9cebe7ae82c0e49ba133abf1.zip
Merge pull request #3092 from fjl/state-journal
core/state: implement reverts by journaling all changes
Diffstat (limited to 'accounts')
-rw-r--r--accounts/abi/bind/backends/simulated.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go
index 7e09abb11..74203a468 100644
--- a/accounts/abi/bind/backends/simulated.go
+++ b/accounts/abi/bind/backends/simulated.go
@@ -172,8 +172,9 @@ func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallM
func (b *SimulatedBackend) PendingCallContract(ctx context.Context, call ethereum.CallMsg) ([]byte, error) {
b.mu.Lock()
defer b.mu.Unlock()
+ defer b.pendingState.RevertToSnapshot(b.pendingState.Snapshot())
- rval, _, err := b.callContract(ctx, call, b.pendingBlock, b.pendingState.Copy())
+ rval, _, err := b.callContract(ctx, call, b.pendingBlock, b.pendingState)
return rval, err
}
@@ -197,8 +198,9 @@ func (b *SimulatedBackend) SuggestGasPrice(ctx context.Context) (*big.Int, error
func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMsg) (*big.Int, error) {
b.mu.Lock()
defer b.mu.Unlock()
+ defer b.pendingState.RevertToSnapshot(b.pendingState.Snapshot())
- _, gas, err := b.callContract(ctx, call, b.pendingBlock, b.pendingState.Copy())
+ _, gas, err := b.callContract(ctx, call, b.pendingBlock, b.pendingState)
return gas, err
}