diff options
Diffstat (limited to 'les/helper_test.go')
-rw-r--r-- | les/helper_test.go | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/les/helper_test.go b/les/helper_test.go index 3e8ce57b6..f37bec80e 100644 --- a/les/helper_test.go +++ b/les/helper_test.go @@ -134,28 +134,31 @@ func testRCL() RequestCostList { // channels for different events. func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *core.BlockGen)) (*ProtocolManager, ethdb.Database, *LesOdr, error) { var ( - evmux = new(event.TypeMux) - pow = new(pow.FakePow) - db, _ = ethdb.NewMemDatabase() - genesis = core.WriteGenesisBlockForTesting(db, core.GenesisAccount{Address: testBankAddress, Balance: testBankFunds}) - chainConfig = ¶ms.ChainConfig{HomesteadBlock: big.NewInt(0)} // homestead set to 0 because of chain maker - odr *LesOdr - chain BlockChain + evmux = new(event.TypeMux) + pow = new(pow.FakePow) + db, _ = ethdb.NewMemDatabase() + gspec = core.Genesis{ + Config: params.TestChainConfig, + Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}, + } + genesis = gspec.MustCommit(db) + odr *LesOdr + chain BlockChain ) if lightSync { odr = NewLesOdr(db) - chain, _ = light.NewLightChain(odr, chainConfig, pow, evmux) + chain, _ = light.NewLightChain(odr, gspec.Config, pow, evmux) } else { - blockchain, _ := core.NewBlockChain(db, chainConfig, pow, evmux, vm.Config{}) - gchain, _ := core.GenerateChain(chainConfig, genesis, db, blocks, generator) + blockchain, _ := core.NewBlockChain(db, gspec.Config, pow, evmux, vm.Config{}) + gchain, _ := core.GenerateChain(gspec.Config, genesis, db, blocks, generator) if _, err := blockchain.InsertChain(gchain); err != nil { panic(err) } chain = blockchain } - pm, err := NewProtocolManager(chainConfig, lightSync, NetworkId, evmux, pow, chain, nil, db, odr, nil) + pm, err := NewProtocolManager(gspec.Config, lightSync, NetworkId, evmux, pow, chain, nil, db, odr, nil) if err != nil { return nil, nil, nil, err } |