Fixed tests
This commit is contained in:
parent
cd856cb213
commit
22b493a6ff
@ -6,14 +6,15 @@ import (
|
|||||||
|
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
|
"github.com/ethereum/go-ethereum/pow/ezp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func proc() (*BlockProcessor, *ChainManager) {
|
func proc() (*BlockProcessor, *ChainManager) {
|
||||||
db, _ := ethdb.NewMemDatabase()
|
db, _ := ethdb.NewMemDatabase()
|
||||||
var mux event.TypeMux
|
var mux event.TypeMux
|
||||||
|
|
||||||
chainMan := NewChainManager(db, &mux)
|
chainMan := NewChainManager(db, db, &mux)
|
||||||
return NewBlockProcessor(db, nil, chainMan, &mux), chainMan
|
return NewBlockProcessor(db, ezp.New(), nil, chainMan, &mux), chainMan
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNumber(t *testing.T) {
|
func TestNumber(t *testing.T) {
|
||||||
@ -21,13 +22,13 @@ func TestNumber(t *testing.T) {
|
|||||||
block1 := chain.NewBlock(nil)
|
block1 := chain.NewBlock(nil)
|
||||||
block1.Header().Number = big.NewInt(3)
|
block1.Header().Number = big.NewInt(3)
|
||||||
|
|
||||||
err := bp.ValidateBlock(block1, chain.Genesis())
|
err := bp.ValidateHeader(block1.Header(), chain.Genesis().Header())
|
||||||
if err != BlockNumberErr {
|
if err != BlockNumberErr {
|
||||||
t.Errorf("expected block number error")
|
t.Errorf("expected block number error")
|
||||||
}
|
}
|
||||||
|
|
||||||
block1 = chain.NewBlock(nil)
|
block1 = chain.NewBlock(nil)
|
||||||
err = bp.ValidateBlock(block1, chain.Genesis())
|
err = bp.ValidateHeader(block1.Header(), chain.Genesis().Header())
|
||||||
if err == BlockNumberErr {
|
if err == BlockNumberErr {
|
||||||
t.Errorf("didn't expect block number error")
|
t.Errorf("didn't expect block number error")
|
||||||
}
|
}
|
||||||
|
@ -257,9 +257,9 @@ func TestChainInsertions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var eventMux event.TypeMux
|
var eventMux event.TypeMux
|
||||||
chainMan := NewChainManager(db, &eventMux)
|
chainMan := NewChainManager(db, db, &eventMux)
|
||||||
txPool := NewTxPool(&eventMux)
|
txPool := NewTxPool(&eventMux)
|
||||||
blockMan := NewBlockProcessor(db, txPool, chainMan, &eventMux)
|
blockMan := NewBlockProcessor(db, nil, txPool, chainMan, &eventMux)
|
||||||
chainMan.SetProcessor(blockMan)
|
chainMan.SetProcessor(blockMan)
|
||||||
|
|
||||||
const max = 2
|
const max = 2
|
||||||
@ -303,9 +303,9 @@ func TestChainMultipleInsertions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var eventMux event.TypeMux
|
var eventMux event.TypeMux
|
||||||
chainMan := NewChainManager(db, &eventMux)
|
chainMan := NewChainManager(db, db, &eventMux)
|
||||||
txPool := NewTxPool(&eventMux)
|
txPool := NewTxPool(&eventMux)
|
||||||
blockMan := NewBlockProcessor(db, txPool, chainMan, &eventMux)
|
blockMan := NewBlockProcessor(db, nil, txPool, chainMan, &eventMux)
|
||||||
chainMan.SetProcessor(blockMan)
|
chainMan.SetProcessor(blockMan)
|
||||||
done := make(chan bool, max)
|
done := make(chan bool, max)
|
||||||
for i, chain := range chains {
|
for i, chain := range chains {
|
||||||
@ -332,7 +332,7 @@ func TestGetAncestors(t *testing.T) {
|
|||||||
|
|
||||||
db, _ := ethdb.NewMemDatabase()
|
db, _ := ethdb.NewMemDatabase()
|
||||||
var eventMux event.TypeMux
|
var eventMux event.TypeMux
|
||||||
chainMan := NewChainManager(db, &eventMux)
|
chainMan := NewChainManager(db, db, &eventMux)
|
||||||
chain, err := loadChain("valid1", t)
|
chain, err := loadChain("valid1", t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
ethlogger "github.com/ethereum/go-ethereu/logger"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/errs"
|
"github.com/ethereum/go-ethereum/errs"
|
||||||
|
Loading…
Reference in New Issue
Block a user