all: cleanup tests (#25641)

Follow-up to PR #25523 to cleanup all relevant tests.
This commit is contained in:
rjl493456442
2022-09-07 20:21:59 +02:00
committed by GitHub
parent d30e39b2f8
commit dea1fb3cfc
35 changed files with 427 additions and 639 deletions
+3 -5
View File
@@ -54,15 +54,13 @@ var (
)
func makechain() (bc *core.BlockChain, addrHashes, txHashes []common.Hash) {
db := rawdb.NewMemoryDatabase()
gspec := core.Genesis{
gspec := &core.Genesis{
Config: params.TestChainConfig,
Alloc: core.GenesisAlloc{bankAddr: {Balance: bankFunds}},
GasLimit: 100000000,
}
genesis := gspec.MustCommit(db)
signer := types.HomesteadSigner{}
blocks, _ := core.GenerateChain(gspec.Config, genesis, ethash.NewFaker(), db, testChainLen,
_, blocks, _ := core.GenerateChainWithGenesis(gspec, ethash.NewFaker(), testChainLen,
func(i int, gen *core.BlockGen) {
var (
tx *types.Transaction
@@ -80,7 +78,7 @@ func makechain() (bc *core.BlockChain, addrHashes, txHashes []common.Hash) {
addrHashes = append(addrHashes, crypto.Keccak256Hash(addr[:]))
txHashes = append(txHashes, tx.Hash())
})
bc, _ = core.NewBlockChain(db, nil, &gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
bc, _ = core.NewBlockChain(rawdb.NewMemoryDatabase(), nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
if _, err := bc.InsertChain(blocks); err != nil {
panic(err)
}
+2 -5
View File
@@ -39,7 +39,6 @@ import (
var trieRoot common.Hash
func getChain() *core.BlockChain {
db := rawdb.NewMemoryDatabase()
ga := make(core.GenesisAlloc, 1000)
var a = make([]byte, 20)
var mkStorage = func(k, v int) (common.Hash, common.Hash) {
@@ -66,9 +65,7 @@ func getChain() *core.BlockChain {
Config: params.TestChainConfig,
Alloc: ga,
}
genesis := gspec.MustCommit(db)
blocks, _ := core.GenerateChain(gspec.Config, genesis, ethash.NewFaker(), db, 2,
func(i int, gen *core.BlockGen) {})
_, blocks, _ := core.GenerateChainWithGenesis(gspec, ethash.NewFaker(), 2, func(i int, gen *core.BlockGen) {})
cacheConf := &core.CacheConfig{
TrieCleanLimit: 0,
TrieDirtyLimit: 0,
@@ -79,7 +76,7 @@ func getChain() *core.BlockChain {
SnapshotWait: true,
}
trieRoot = blocks[len(blocks)-1].Root()
bc, _ := core.NewBlockChain(db, cacheConf, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
bc, _ := core.NewBlockChain(rawdb.NewMemoryDatabase(), cacheConf, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
if _, err := bc.InsertChain(blocks); err != nil {
panic(err)
}