triedb: set generate progress to 100 after root verification

Only report completion once the assembled trie root matches the
expected root, not immediately after worker goroutines finish.
This commit is contained in:
Weixie Cui 2026-06-29 20:21:40 +08:00
parent ab134b2101
commit 172dd2e1fc

View file

@ -423,9 +423,6 @@ func GenerateTrieWithProgress(db ethdb.Database, scheme string, root common.Hash
if err := eg.Wait(); err != nil {
return GenerateStats{}, err
}
if prog != nil {
prog.Store(100)
}
// Assemble the top-level root from the partition blobs and verify it
// matches the expected root.
got, err := assembleRoot(db, scheme, partitionBlobs)
@ -435,6 +432,9 @@ func GenerateTrieWithProgress(db ethdb.Database, scheme string, root common.Hash
if got != root {
return GenerateStats{}, fmt.Errorf("state root mismatch: got %x, want %x", got, root)
}
if prog != nil {
prog.Store(100)
}
log.Info("Generated state trie",
"accounts", c.accounts.Load(), "slots", c.slots.Load(),
"account-nodes", c.accountTrieNodes.Load(), "storage-nodes", c.storageTrieNodes.Load(),