aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-07 03:07:35 +0800
committerobscuren <geffobscura@gmail.com>2015-03-07 03:10:59 +0800
commit22b493a6ff3e9692676c17f8d766ff1117da9485 (patch)
tree3e39656fa5769b6bb36a07f21f5dc9a2c4566978
parentcd856cb2133d390758bb24b88fa3b538bb7bc306 (diff)
downloaddexon-22b493a6ff3e9692676c17f8d766ff1117da9485.tar.gz
dexon-22b493a6ff3e9692676c17f8d766ff1117da9485.tar.zst
dexon-22b493a6ff3e9692676c17f8d766ff1117da9485.zip
Fixed tests
-rw-r--r--core/block_processor_test.go9
-rw-r--r--core/chain_manager_test.go10
-rw-r--r--eth/protocol_test.go1
3 files changed, 11 insertions, 9 deletions
diff --git a/core/block_processor_test.go b/core/block_processor_test.go
index 35aeaa714..a031c2669 100644
--- a/core/block_processor_test.go
+++ b/core/block_processor_test.go
@@ -6,14 +6,15 @@ import (
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
+ "github.com/ethereum/go-ethereum/pow/ezp"
)
func proc() (*BlockProcessor, *ChainManager) {
db, _ := ethdb.NewMemDatabase()
var mux event.TypeMux
- chainMan := NewChainManager(db, &mux)
- return NewBlockProcessor(db, nil, chainMan, &mux), chainMan
+ chainMan := NewChainManager(db, db, &mux)
+ return NewBlockProcessor(db, ezp.New(), nil, chainMan, &mux), chainMan
}
func TestNumber(t *testing.T) {
@@ -21,13 +22,13 @@ func TestNumber(t *testing.T) {
block1 := chain.NewBlock(nil)
block1.Header().Number = big.NewInt(3)
- err := bp.ValidateBlock(block1, chain.Genesis())
+ err := bp.ValidateHeader(block1.Header(), chain.Genesis().Header())
if err != BlockNumberErr {
t.Errorf("expected block number error")
}
block1 = chain.NewBlock(nil)
- err = bp.ValidateBlock(block1, chain.Genesis())
+ err = bp.ValidateHeader(block1.Header(), chain.Genesis().Header())
if err == BlockNumberErr {
t.Errorf("didn't expect block number error")
}
diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go
index b562b677d..e78c2e980 100644
--- a/core/chain_manager_test.go
+++ b/core/chain_manager_test.go
@@ -257,9 +257,9 @@ func TestChainInsertions(t *testing.T) {
}
var eventMux event.TypeMux
- chainMan := NewChainManager(db, &eventMux)
+ chainMan := NewChainManager(db, db, &eventMux)
txPool := NewTxPool(&eventMux)
- blockMan := NewBlockProcessor(db, txPool, chainMan, &eventMux)
+ blockMan := NewBlockProcessor(db, nil, txPool, chainMan, &eventMux)
chainMan.SetProcessor(blockMan)
const max = 2
@@ -303,9 +303,9 @@ func TestChainMultipleInsertions(t *testing.T) {
}
}
var eventMux event.TypeMux
- chainMan := NewChainManager(db, &eventMux)
+ chainMan := NewChainManager(db, db, &eventMux)
txPool := NewTxPool(&eventMux)
- blockMan := NewBlockProcessor(db, txPool, chainMan, &eventMux)
+ blockMan := NewBlockProcessor(db, nil, txPool, chainMan, &eventMux)
chainMan.SetProcessor(blockMan)
done := make(chan bool, max)
for i, chain := range chains {
@@ -332,7 +332,7 @@ func TestGetAncestors(t *testing.T) {
db, _ := ethdb.NewMemDatabase()
var eventMux event.TypeMux
- chainMan := NewChainManager(db, &eventMux)
+ chainMan := NewChainManager(db, db, &eventMux)
chain, err := loadChain("valid1", t)
if err != nil {
fmt.Println(err)
diff --git a/eth/protocol_test.go b/eth/protocol_test.go
index c4e3e9f1b..c118e6aae 100644
--- a/eth/protocol_test.go
+++ b/eth/protocol_test.go
@@ -9,6 +9,7 @@ import (
"testing"
"time"
+ ethlogger "github.com/ethereum/go-ethereu/logger"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/errs"