ensure non-mutated storage slots are included in witness when snapshot is enabled

This commit is contained in:
Jared Wasinger 2024-02-13 07:44:55 -08:00
parent 4943bd8bbb
commit 494ba791a1
2 changed files with 10 additions and 3 deletions

View file

@ -921,14 +921,13 @@ func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
prefetcher := s.prefetcher
if s.prefetcher != nil {
defer func() {
// TODO: need to wait for read accounts to be resolved in prefetcher main trie?
s.prefetcher.close()
s.prefetcher.wait()
if s.witness != nil {
// TODO: move read prefetcher logic into Commit?
s.collectReadStorageAccessLists()
s.collectReadAccountsAccessLists()
}
s.prefetcher.close()
s.prefetcher = nil
}()
}

View file

@ -210,6 +210,14 @@ func (sf *subfetcher) schedule(keys [][]byte) {
}
}
// wait instructs all subfetchers to finish their tasks
// and stop receiving new requests.
func (p *triePrefetcher) wait() {
for _, fetcher := range p.fetchers {
fetcher.wait()
}
}
// wait waits for the subfetcher to finish it's task. It is safe to call wait multiple
// times but it is not thread safe.
func (sf *subfetcher) wait() {