adapt blockpool/backend to use pow/ezp with pow.Block for VerifyPoW func

This commit is contained in:
zelig 2014-12-14 20:08:24 +00:00
parent 61940b2275
commit 4c89d5331f
2 changed files with 3 additions and 12 deletions

View File

@ -7,12 +7,12 @@ import (
"sync" "sync"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
ethlogger "github.com/ethereum/go-ethereum/logger" ethlogger "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/pow/ezp"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/state"
) )
@ -111,9 +111,8 @@ func New(db ethutil.Database, identity p2p.ClientIdentity, keyManager *crypto.Ke
hasBlock := eth.chainManager.HasBlock hasBlock := eth.chainManager.HasBlock
insertChain := eth.chainManager.InsertChain insertChain := eth.chainManager.InsertChain
// pow := ezp.New() pow := ezp.New()
// verifyPoW := pow.Verify verifyPoW := pow.Verify
verifyPoW := func(*types.Block) bool { return true }
eth.blockPool = NewBlockPool(hasBlock, insertChain, verifyPoW) eth.blockPool = NewBlockPool(hasBlock, insertChain, verifyPoW)
// Start the tx pool // Start the tx pool

View File

@ -55,11 +55,7 @@ type BlockPool struct {
// the minimal interface with blockchain // the minimal interface with blockchain
hasBlock func(hash []byte) bool hasBlock func(hash []byte) bool
insertChain func(types.Blocks) error insertChain func(types.Blocks) error
<<<<<<< HEAD
verifyPoW func(pow.Block) bool verifyPoW func(pow.Block) bool
=======
verifyPoW func(*types.Block) bool
>>>>>>> blockpool rewritten , tests broken FIXME
} }
type peerInfo struct { type peerInfo struct {
@ -78,11 +74,7 @@ type peerInfo struct {
quitC chan bool quitC chan bool
} }
<<<<<<< HEAD
func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(pow.Block) bool, func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(pow.Block) bool,
=======
func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(*types.Block) bool,
>>>>>>> blockpool rewritten , tests broken FIXME
) *BlockPool { ) *BlockPool {
return &BlockPool{ return &BlockPool{
hasBlock: hasBlock, hasBlock: hasBlock,