mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
e3: enable simulated backend (#7245)
This commit is contained in:
parent
8720641c3a
commit
bd83f85912
@ -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.
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user