mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-04-29 12:52:55 +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) {
|
if genesis.Config != nil && genesis.Config.IsVerkle(genesis.Config.ChainID, 0) {
|
||||||
triedbConfig = triedb.VerkleDefaults
|
triedbConfig = triedb.VerkleDefaults
|
||||||
}
|
}
|
||||||
triedb := triedb.NewDatabase(db, triedbConfig)
|
genesisTriedb := triedb.NewDatabase(db, triedbConfig)
|
||||||
defer triedb.Close()
|
block, err := genesis.Commit(db, genesisTriedb, nil)
|
||||||
_, err := genesis.Commit(db, triedb, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
genesisTriedb.Close()
|
||||||
panic(err)
|
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
|
return db, blocks, receipts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue