core: initial version of state snapshots
This commit is contained in:
@ -64,7 +64,7 @@ func (h resultHash) Less(i, j int) bool { return bytes.Compare(h[i].Bytes(), h[j
|
||||
func TestAccountRange(t *testing.T) {
|
||||
var (
|
||||
statedb = state.NewDatabase(rawdb.NewMemoryDatabase())
|
||||
state, _ = state.New(common.Hash{}, statedb)
|
||||
state, _ = state.New(common.Hash{}, statedb, nil)
|
||||
addrs = [AccountRangeMaxResults * 2]common.Address{}
|
||||
m = map[common.Address]bool{}
|
||||
)
|
||||
@ -162,7 +162,7 @@ func TestAccountRange(t *testing.T) {
|
||||
func TestEmptyAccountRange(t *testing.T) {
|
||||
var (
|
||||
statedb = state.NewDatabase(rawdb.NewMemoryDatabase())
|
||||
state, _ = state.New(common.Hash{}, statedb)
|
||||
state, _ = state.New(common.Hash{}, statedb, nil)
|
||||
)
|
||||
|
||||
state.Commit(true)
|
||||
@ -188,7 +188,7 @@ func TestEmptyAccountRange(t *testing.T) {
|
||||
func TestStorageRangeAt(t *testing.T) {
|
||||
// Create a state where account 0x010000... has a few storage entries.
|
||||
var (
|
||||
state, _ = state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()))
|
||||
state, _ = state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()), nil)
|
||||
addr = common.Address{0x01}
|
||||
keys = []common.Hash{ // hashes of Keys of storage
|
||||
common.HexToHash("340dd630ad21bf010b4e676dbfa9ba9a02175262d1fa356232cfde6cb5b47ef2"),
|
||||
|
@ -155,7 +155,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
|
||||
return nil, fmt.Errorf("parent block #%d not found", number-1)
|
||||
}
|
||||
}
|
||||
statedb, err := state.New(start.Root(), database)
|
||||
statedb, err := state.New(start.Root(), database, nil)
|
||||
if err != nil {
|
||||
// If the starting state is missing, allow some number of blocks to be reexecuted
|
||||
reexec := defaultTraceReexec
|
||||
@ -168,7 +168,7 @@ func (api *PrivateDebugAPI) traceChain(ctx context.Context, start, end *types.Bl
|
||||
if start == nil {
|
||||
break
|
||||
}
|
||||
if statedb, err = state.New(start.Root(), database); err == nil {
|
||||
if statedb, err = state.New(start.Root(), database, nil); err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -648,7 +648,7 @@ func (api *PrivateDebugAPI) computeStateDB(block *types.Block, reexec uint64) (*
|
||||
if block == nil {
|
||||
break
|
||||
}
|
||||
if statedb, err = state.New(block.Root(), database); err == nil {
|
||||
if statedb, err = state.New(block.Root(), database, nil); err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ func testGetNodeData(t *testing.T, protocol int) {
|
||||
}
|
||||
accounts := []common.Address{testBank, acc1Addr, acc2Addr}
|
||||
for i := uint64(0); i <= pm.blockchain.CurrentBlock().NumberU64(); i++ {
|
||||
trie, _ := state.New(pm.blockchain.GetBlockByNumber(i).Root(), state.NewDatabase(statedb))
|
||||
trie, _ := state.New(pm.blockchain.GetBlockByNumber(i).Root(), state.NewDatabase(statedb), nil)
|
||||
|
||||
for j, acc := range accounts {
|
||||
state, _ := pm.blockchain.State()
|
||||
|
Reference in New Issue
Block a user