|
|
@ -11,6 +11,7 @@ import ( |
|
|
|
"github.com/ethereum/go-ethereum/core/types" |
|
|
|
"github.com/ethereum/go-ethereum/core/types" |
|
|
|
"github.com/ethereum/go-ethereum/ethutil" |
|
|
|
"github.com/ethereum/go-ethereum/ethutil" |
|
|
|
ethlogger "github.com/ethereum/go-ethereum/logger" |
|
|
|
ethlogger "github.com/ethereum/go-ethereum/logger" |
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/pow" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var poolLogger = ethlogger.NewLogger("Blockpool") |
|
|
|
var poolLogger = ethlogger.NewLogger("Blockpool") |
|
|
@ -54,7 +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 |
|
|
|
verifyPoW func(*types.Block) bool |
|
|
|
verifyPoW func(pow.Block) bool |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type peerInfo struct { |
|
|
|
type peerInfo struct { |
|
|
@ -73,7 +74,7 @@ type peerInfo struct { |
|
|
|
quitC chan bool |
|
|
|
quitC chan bool |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(*types.Block) bool, |
|
|
|
func NewBlockPool(hasBlock func(hash []byte) bool, insertChain func(types.Blocks) error, verifyPoW func(pow.Block) bool, |
|
|
|
) *BlockPool { |
|
|
|
) *BlockPool { |
|
|
|
return &BlockPool{ |
|
|
|
return &BlockPool{ |
|
|
|
hasBlock: hasBlock, |
|
|
|
hasBlock: hasBlock, |
|
|
|