mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-12 22:29:02 +00:00
core: fix TestProcessVerkle flaky test (#33971)
`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:
parent
3f1871524f
commit
ecee64ecdc
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue