core: fix TestProcessVerkle flaky test (#33971)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

`GenerateChain` commits trie nodes asynchronously, and it can happen
that some nodes aren't making it to the db in time for `GenerateChain`
to open it and find the data it is looking for.
This commit is contained in:
Guillaume Ballet 2026-03-06 19:03:05 +01:00 committed by GitHub
parent 3f1871524f
commit ecee64ecdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -481,13 +481,14 @@ func GenerateChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int,
if genesis.Config != nil && genesis.Config.IsVerkle(genesis.Config.ChainID, 0) {
triedbConfig = triedb.VerkleDefaults
}
triedb := triedb.NewDatabase(db, triedbConfig)
defer triedb.Close()
_, err := genesis.Commit(db, triedb, nil)
genesisTriedb := triedb.NewDatabase(db, triedbConfig)
block, err := genesis.Commit(db, genesisTriedb, nil)
if err != nil {
genesisTriedb.Close()
panic(err)
}
blocks, receipts := GenerateChain(genesis.Config, genesis.ToBlock(), engine, db, n, gen)
genesisTriedb.Close()
blocks, receipts := GenerateChain(genesis.Config, block, engine, db, n, gen)
return db, blocks, receipts
}