aboutsummaryrefslogtreecommitdiffstats
path: root/eth/helper_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-09-01 22:35:14 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-10-19 15:03:09 +0800
commit92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8 (patch)
tree77a19060ee7b46cd7819894babe24130b952c4ca /eth/helper_test.go
parent10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0 (diff)
downloadgo-tangerine-92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8.tar
go-tangerine-92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8.tar.gz
go-tangerine-92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8.tar.bz2
go-tangerine-92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8.tar.lz
go-tangerine-92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8.tar.xz
go-tangerine-92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8.tar.zst
go-tangerine-92f9a3e5fa29e0f05c81b348b87cab4f7a94f0c8.zip
cmd, eth: support switching client modes of operation
Diffstat (limited to 'eth/helper_test.go')
-rw-r--r--eth/helper_test.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/eth/helper_test.go b/eth/helper_test.go
index 9314884ef..bd65b49f8 100644
--- a/eth/helper_test.go
+++ b/eth/helper_test.go
@@ -28,7 +28,7 @@ var (
// newTestProtocolManager creates a new protocol manager for testing purposes,
// with the given number of blocks already known, and potential notification
// channels for different events.
-func newTestProtocolManager(blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) *ProtocolManager {
+func newTestProtocolManager(mode Mode, blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) (*ProtocolManager, error) {
var (
evmux = new(event.TypeMux)
pow = new(core.FakePow)
@@ -42,8 +42,23 @@ func newTestProtocolManager(blocks int, generator func(int, *core.BlockGen), new
if _, err := blockchain.InsertChain(chain); err != nil {
panic(err)
}
- pm := NewProtocolManager(NetworkId, evmux, &testTxPool{added: newtx}, pow, blockchain, db)
+ pm, err := NewProtocolManager(mode, NetworkId, evmux, &testTxPool{added: newtx}, pow, blockchain, db)
+ if err != nil {
+ return nil, err
+ }
pm.Start()
+ return pm, nil
+}
+
+// newTestProtocolManagerMust creates a new protocol manager for testing purposes,
+// with the given number of blocks already known, and potential notification
+// channels for different events. In case of an error, the constructor force-
+// fails the test.
+func newTestProtocolManagerMust(t *testing.T, mode Mode, blocks int, generator func(int, *core.BlockGen), newtx chan<- []*types.Transaction) *ProtocolManager {
+ pm, err := newTestProtocolManager(mode, blocks, generator, newtx)
+ if err != nil {
+ t.Fatalf("Failed to create protocol manager: %v", err)
+ }
return pm
}