trie: remove node ordering slice in sync batch (#19929)

When we flush a batch of trie nodes into database during the state
sync, we should guarantee that all children should be flushed before
parent.

Actually the trie nodes commit order is strict by: children -> parent.
But when we flush all ready nodes into db, we don't need the order
anymore since

    (1) they are all ready nodes (no more dependency)
    (2) underlying database provides write atomicity
This commit is contained in:
gary rong
2019-10-29 02:50:11 +09:00
committed by Felix Lange
parent 9c81387bef
commit ecdbb402ee
4 changed files with 63 additions and 46 deletions

View File

@ -347,7 +347,7 @@ func (s *stateSync) commit(force bool) error {
}
start := time.Now()
b := s.d.stateDB.NewBatch()
if written, err := s.sched.Commit(b); written == 0 || err != nil {
if err := s.sched.Commit(b); err != nil {
return err
}
if err := b.Write(); err != nil {