diff options
author | Wenbiao Zheng <delweng@gmail.com> | 2018-06-19 19:41:13 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-06-19 19:41:13 +0800 |
commit | 9b1536b26a78341008c5efe962f916d12220e720 (patch) | |
tree | 4668e7f4f57ba810a06e3054ff36c1828f3279f3 /core/chain_makers.go | |
parent | 3e57c33147bf05329dd9ef9868c04e301ac8bb58 (diff) | |
download | dexon-9b1536b26a78341008c5efe962f916d12220e720.tar dexon-9b1536b26a78341008c5efe962f916d12220e720.tar.gz dexon-9b1536b26a78341008c5efe962f916d12220e720.tar.bz2 dexon-9b1536b26a78341008c5efe962f916d12220e720.tar.lz dexon-9b1536b26a78341008c5efe962f916d12220e720.tar.xz dexon-9b1536b26a78341008c5efe962f916d12220e720.tar.zst dexon-9b1536b26a78341008c5efe962f916d12220e720.zip |
core: remove dead code, limit test code scope (#17006)
* core: move test util var/func to test file
* core: remove useless func
Diffstat (limited to 'core/chain_makers.go')
-rw-r--r-- | core/chain_makers.go | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/core/chain_makers.go b/core/chain_makers.go index fcba90bb8..c1e4b4264 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -30,12 +30,6 @@ import ( "github.com/ethereum/go-ethereum/params" ) -// So we can deterministically seed different blockchains -var ( - canonicalSeed = 1 - forkSeed = 2 -) - // BlockGen creates blocks for testing. // See GenerateChain for a detailed explanation. type BlockGen struct { @@ -252,33 +246,6 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S } } -// newCanonical creates a chain database, and injects a deterministic canonical -// chain. Depending on the full flag, if creates either a full block chain or a -// header only chain. -func newCanonical(engine consensus.Engine, n int, full bool) (ethdb.Database, *BlockChain, error) { - var ( - db = ethdb.NewMemDatabase() - genesis = new(Genesis).MustCommit(db) - ) - - // Initialize a fresh chain with only a genesis block - blockchain, _ := NewBlockChain(db, nil, params.AllEthashProtocolChanges, engine, vm.Config{}) - // Create and inject the requested chain - if n == 0 { - return db, blockchain, nil - } - if full { - // Full block-chain requested - blocks := makeBlockChain(genesis, n, engine, db, canonicalSeed) - _, err := blockchain.InsertChain(blocks) - return db, blockchain, err - } - // Header-only chain requested - headers := makeHeaderChain(genesis.Header(), n, engine, db, canonicalSeed) - _, err := blockchain.InsertHeaderChain(headers, 1) - return db, blockchain, err -} - // makeHeaderChain creates a deterministic chain of headers rooted at parent. func makeHeaderChain(parent *types.Header, n int, engine consensus.Engine, db ethdb.Database, seed int) []*types.Header { blocks := makeBlockChain(types.NewBlockWithHeader(parent), n, engine, db, seed) |