core, trie: intermediate mempool between trie and database (#15857)
This commit reduces database I/O by not writing every state trie to disk.
This commit is contained in:
committed by
Felix Lange
parent
59336283c0
commit
55599ee95d
@ -125,7 +125,7 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateD
|
||||
if !ok {
|
||||
return nil, UnsupportedForkError{subtest.Fork}
|
||||
}
|
||||
block, _ := t.genesis(config).ToBlock()
|
||||
block := t.genesis(config).ToBlock(nil)
|
||||
db, _ := ethdb.NewMemDatabase()
|
||||
statedb := MakePreState(db, t.json.Pre)
|
||||
|
||||
@ -147,7 +147,7 @@ func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateD
|
||||
if logs := rlpHash(statedb.Logs()); logs != common.Hash(post.Logs) {
|
||||
return statedb, fmt.Errorf("post state logs hash mismatch: got %x, want %x", logs, post.Logs)
|
||||
}
|
||||
root, _ := statedb.CommitTo(db, config.IsEIP158(block.Number()))
|
||||
root, _ := statedb.Commit(config.IsEIP158(block.Number()))
|
||||
if root != common.Hash(post.Root) {
|
||||
return statedb, fmt.Errorf("post state root mismatch: got %x, want %x", root, post.Root)
|
||||
}
|
||||
@ -170,7 +170,7 @@ func MakePreState(db ethdb.Database, accounts core.GenesisAlloc) *state.StateDB
|
||||
}
|
||||
}
|
||||
// Commit and re-open to start with a clean state.
|
||||
root, _ := statedb.CommitTo(db, false)
|
||||
root, _ := statedb.Commit(false)
|
||||
statedb, _ = state.New(root, sdb)
|
||||
return statedb
|
||||
}
|
||||
|
Reference in New Issue
Block a user