diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-04-05 06:16:29 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-04-05 06:16:29 +0800 |
commit | 09777952ee476ff80d4b6e63b5041ff5ca0e441b (patch) | |
tree | e85320f88f548201e3476b3e7095e96fd071617b /les/helper_test.go | |
parent | e50a5b77712d891ff409aa942a5cbc24e721b332 (diff) | |
download | dexon-09777952ee476ff80d4b6e63b5041ff5ca0e441b.tar.gz dexon-09777952ee476ff80d4b6e63b5041ff5ca0e441b.tar.zst dexon-09777952ee476ff80d4b6e63b5041ff5ca0e441b.zip |
core, consensus: pluggable consensus engines (#3817)
This commit adds pluggable consensus engines to go-ethereum. In short, it
introduces a generic consensus interface, and refactors the entire codebase to
use this interface.
Diffstat (limited to 'les/helper_test.go')
-rw-r--r-- | les/helper_test.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/les/helper_test.go b/les/helper_test.go index f37bec80e..7e442c131 100644 --- a/les/helper_test.go +++ b/les/helper_test.go @@ -28,6 +28,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" @@ -39,7 +40,6 @@ import ( "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/pow" ) var ( @@ -134,10 +134,10 @@ 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() - gspec = core.Genesis{ + evmux = new(event.TypeMux) + engine = ethash.NewFaker() + db, _ = ethdb.NewMemDatabase() + gspec = core.Genesis{ Config: params.TestChainConfig, Alloc: core.GenesisAlloc{testBankAddress: {Balance: testBankFunds}}, } @@ -148,9 +148,9 @@ func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *cor if lightSync { odr = NewLesOdr(db) - chain, _ = light.NewLightChain(odr, gspec.Config, pow, evmux) + chain, _ = light.NewLightChain(odr, gspec.Config, engine, evmux) } else { - blockchain, _ := core.NewBlockChain(db, gspec.Config, pow, evmux, vm.Config{}) + blockchain, _ := core.NewBlockChain(db, gspec.Config, engine, evmux, vm.Config{}) gchain, _ := core.GenerateChain(gspec.Config, genesis, db, blocks, generator) if _, err := blockchain.InsertChain(gchain); err != nil { panic(err) @@ -158,7 +158,7 @@ func newTestProtocolManager(lightSync bool, blocks int, generator func(int, *cor chain = blockchain } - pm, err := NewProtocolManager(gspec.Config, lightSync, NetworkId, evmux, pow, chain, nil, db, odr, nil) + pm, err := NewProtocolManager(gspec.Config, lightSync, NetworkId, evmux, engine, chain, nil, db, odr, nil) if err != nil { return nil, nil, nil, err } |