mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
core: cleanup tests (#25641)
This commit is contained in:
parent
ad71d706fb
commit
09d3ede8c0
1 changed files with 13 additions and 0 deletions
|
|
@ -244,6 +244,19 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
||||||
return blocks, receipts
|
return blocks, receipts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GenerateChainWithGenesis is a wrapper of GenerateChain which will initialize
|
||||||
|
// genesis block to database first according to the provided genesis specification
|
||||||
|
// then generate chain on top.
|
||||||
|
func GenerateChainWithGenesis(genesis *Genesis, engine consensus.Engine, n int, gen func(int, *BlockGen)) (ethdb.Database, []*types.Block, []types.Receipts) {
|
||||||
|
db := rawdb.NewMemoryDatabase()
|
||||||
|
_, err := genesis.Commit(db)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
blocks, receipts := GenerateChain(genesis.Config, genesis.ToBlock(nil), engine, db, n, gen)
|
||||||
|
return db, blocks, receipts
|
||||||
|
}
|
||||||
|
|
||||||
func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.StateDB, engine consensus.Engine) *types.Header {
|
func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.StateDB, engine consensus.Engine) *types.Header {
|
||||||
var time *big.Int
|
var time *big.Int
|
||||||
if parent.Time() == nil {
|
if parent.Time() == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue