diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 522fcf846..d86266a66 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -199,11 +199,11 @@ func (b *SimulatedBackend) emptyPendingBlock() { // stateByBlockNumber retrieves a state by a given blocknumber. func (b *SimulatedBackend) stateByBlockNumber(db kv.Tx, blockNumber *big.Int) *state.IntraBlockState { if blockNumber == nil || blockNumber.Cmp(b.pendingBlock.Number()) == 0 { - return state.New(state.NewPlainState(db, b.pendingBlock.NumberU64()+1, nil)) - //return state.New(b.m.NewHistoryStateReader(b.pendingBlock.NumberU64()+1, db)) + //return state.New(state.NewPlainState(db, b.pendingBlock.NumberU64()+1, nil)) + return state.New(b.m.NewHistoryStateReader(b.pendingBlock.NumberU64()+1, db)) } - return state.New(state.NewPlainState(db, blockNumber.Uint64()+1, nil)) - //return state.New(b.m.NewHistoryStateReader(blockNumber.Uint64()+1, db)) + //return state.New(state.NewPlainState(db, blockNumber.Uint64()+1, nil)) + return state.New(b.m.NewHistoryStateReader(blockNumber.Uint64()+1, db)) } // CodeAt returns the code associated with a certain account in the blockchain. diff --git a/accounts/abi/bind/backends/simulated_test.go b/accounts/abi/bind/backends/simulated_test.go index 287f2a126..38afb19e9 100644 --- a/accounts/abi/bind/backends/simulated_test.go +++ b/accounts/abi/bind/backends/simulated_test.go @@ -35,7 +35,6 @@ import ( "github.com/ledgerwatch/erigon/common" "github.com/ledgerwatch/erigon/common/u256" "github.com/ledgerwatch/erigon/core/rawdb" - "github.com/ledgerwatch/erigon/core/state" "github.com/ledgerwatch/erigon/core/types" "github.com/ledgerwatch/erigon/crypto" "github.com/ledgerwatch/erigon/params" @@ -147,8 +146,8 @@ func TestNewSimulatedBackend(t *testing.T) { t.Fatal(err) } - //statedb := sim.stateByBlockNumber(tx, big.NewInt(int64(num+1))) - statedb := state.New(state.NewPlainState(tx, num+1, nil)) + statedb := sim.stateByBlockNumber(tx, big.NewInt(int64(num+1))) + //statedb := state.New(state.NewPlainState(tx, num+1, nil)) bal := statedb.GetBalance(testAddr) if !bal.Eq(expectedBal) { t.Errorf("expected balance for test address not received. expected: %v actual: %v", expectedBal, bal)