From 5f8888e11606296c9582496974c0f6b96a882146 Mon Sep 17 00:00:00 2001 From: gary rong Date: Fri, 22 Dec 2017 20:37:50 +0800 Subject: accounts, consensus, core, eth: make chain maker consensus agnostic (#15497) * accounts, consensus, core, eth: make chain maker consensus agnostic * consensus, core: move CalcDifficulty to Engine interface * consensus: add docs for calcDifficulty function * consensus, core: minor comment fixups --- light/lightchain_test.go | 2 +- light/odr_test.go | 2 +- light/trie_test.go | 2 +- light/txpool_test.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'light') diff --git a/light/lightchain_test.go b/light/lightchain_test.go index 40a4d396a..0af7551d4 100644 --- a/light/lightchain_test.go +++ b/light/lightchain_test.go @@ -37,7 +37,7 @@ var ( // makeHeaderChain creates a deterministic chain of headers rooted at parent. func makeHeaderChain(parent *types.Header, n int, db ethdb.Database, seed int) []*types.Header { - blocks, _ := core.GenerateChain(params.TestChainConfig, types.NewBlockWithHeader(parent), db, n, func(i int, b *core.BlockGen) { + blocks, _ := core.GenerateChain(params.TestChainConfig, types.NewBlockWithHeader(parent), ethash.NewFaker(), db, n, func(i int, b *core.BlockGen) { b.SetCoinbase(common.Address{0: byte(seed), 19: byte(i)}) }) headers := make([]*types.Header, len(blocks)) diff --git a/light/odr_test.go b/light/odr_test.go index e6afb1a48..c0eb409f9 100644 --- a/light/odr_test.go +++ b/light/odr_test.go @@ -242,7 +242,7 @@ func testChainOdr(t *testing.T, protocol int, fn odrTestFn) { gspec.MustCommit(ldb) // Assemble the test environment blockchain, _ := core.NewBlockChain(sdb, params.TestChainConfig, ethash.NewFullFaker(), vm.Config{}) - gchain, _ := core.GenerateChain(params.TestChainConfig, genesis, sdb, 4, testChainGen) + gchain, _ := core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), sdb, 4, testChainGen) if _, err := blockchain.InsertChain(gchain); err != nil { t.Fatal(err) } diff --git a/light/trie_test.go b/light/trie_test.go index 5f45c01af..d99664718 100644 --- a/light/trie_test.go +++ b/light/trie_test.go @@ -41,7 +41,7 @@ func TestNodeIterator(t *testing.T) { ) gspec.MustCommit(lightdb) blockchain, _ := core.NewBlockChain(fulldb, params.TestChainConfig, ethash.NewFullFaker(), vm.Config{}) - gchain, _ := core.GenerateChain(params.TestChainConfig, genesis, fulldb, 4, testChainGen) + gchain, _ := core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), fulldb, 4, testChainGen) if _, err := blockchain.InsertChain(gchain); err != nil { panic(err) } diff --git a/light/txpool_test.go b/light/txpool_test.go index fe7936ac2..2ef9e0cf5 100644 --- a/light/txpool_test.go +++ b/light/txpool_test.go @@ -89,7 +89,7 @@ func TestTxPool(t *testing.T) { gspec.MustCommit(ldb) // Assemble the test environment blockchain, _ := core.NewBlockChain(sdb, params.TestChainConfig, ethash.NewFullFaker(), vm.Config{}) - gchain, _ := core.GenerateChain(params.TestChainConfig, genesis, sdb, poolTestBlocks, txPoolTestChainGen) + gchain, _ := core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), sdb, poolTestBlocks, txPoolTestChainGen) if _, err := blockchain.InsertChain(gchain); err != nil { panic(err) } -- cgit v1.2.3