aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--blockpool/blockpool.go3
-rw-r--r--core/chain_manager.go1
-rw-r--r--core/types/block.go4
3 files changed, 7 insertions, 1 deletions
diff --git a/blockpool/blockpool.go b/blockpool/blockpool.go
index d823d9898..e1891f5f4 100644
--- a/blockpool/blockpool.go
+++ b/blockpool/blockpool.go
@@ -782,7 +782,8 @@ LOOP:
// check if block's actual TD (calculated after successful insertChain) is identical to TD advertised for peer's head block.
func (self *BlockPool) checkTD(nodes ...*node) {
for _, n := range nodes {
- if n.td != nil {
+ // skip check if queued future block
+ if n.td != nil && !n.block.Queued() {
plog.DebugDetailf("peer td %v =?= block td %v", n.td, n.block.Td)
if n.td.Cmp(n.block.Td) != 0 {
self.peers.peerError(n.blockBy, ErrIncorrectTD, "on block %x", n.hash)
diff --git a/core/chain_manager.go b/core/chain_manager.go
index 3ab95d272..f05a6bd72 100644
--- a/core/chain_manager.go
+++ b/core/chain_manager.go
@@ -471,6 +471,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
// Do not penelise on future block. We'll need a block queue eventually that will queue
// future block for future use
if err == BlockFutureErr {
+ block.SetQueued(true)
self.futureBlocks.Push(block)
stats.queued++
continue
diff --git a/core/types/block.go b/core/types/block.go
index 116acbf79..c47b555ed 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -97,6 +97,7 @@ type Block struct {
uncles []*Header
transactions Transactions
Td *big.Int
+ queued bool // flag for blockpool to skip TD check
receipts Receipts
}
@@ -268,6 +269,9 @@ func (self *Block) SetNonce(nonce uint64) {
self.header.SetNonce(nonce)
}
+func (self *Block) Queued() bool { return self.queued }
+func (self *Block) SetQueued(q bool) { self.queued = q }
+
func (self *Block) Bloom() Bloom { return self.header.Bloom }
func (self *Block) Coinbase() common.Address { return self.header.Coinbase }
func (self *Block) Time() int64 { return int64(self.header.Time) }