diff --git a/core/tx_pool.go b/core/tx_pool.go index 47ec340f9e..fc78d5e8b7 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -831,7 +831,7 @@ func (pool *TxPool) promoteSpecialTx(addr common.Address, tx *types.Transaction) go func() { for _, btx := range broadcastTxs { pool.specialTxFeed.Send(TxPreEvent{btx}) - log.Debug("Pooled new special transaction", "hash", tx.Hash(), "from", addr, "to", tx.To(), "nonce", tx.Nonce()) + log.Trace("Pooled new special transaction", "hash", tx.Hash(), "from", addr, "to", tx.To(), "nonce", tx.Nonce()) } }() return true, nil diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index 318e3b5848..9b846ef76a 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -605,7 +605,7 @@ func (f *Fetcher) rescheduleComplete(complete *time.Timer) { func (f *Fetcher) enqueue(peer string, block *types.Block) { hash := block.Hash() if f.knowns.Contains(hash) { - log.Debug("Discarded propagated block, knowns block", "peer", peer, "number", block.Number(), "hash", hash, "limit", blockLimit) + log.Debug("Discarded propagated block, known block", "peer", peer, "number", block.Number(), "hash", hash, "limit", blockLimit) return } // Ensure the peer isn't DOSing us diff --git a/eth/handler.go b/eth/handler.go index efb0d4ab58..2cae0a0e6c 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -209,7 +209,7 @@ func (pm *ProtocolManager) Start(maxPeers int) { pm.txSub = pm.txpool.SubscribeTxPreEvent(pm.txCh) go pm.txBroadcastLoop() - // broadcast special transactions + // broadcast special transactions pm.specialTxCh = make(chan core.TxPreEvent, txChanSize) pm.specialTxSub = pm.txpool.SubscribeSpecialTxPreEvent(pm.specialTxCh) go pm.specialTxBroadcastLoop() @@ -651,14 +651,17 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { trueTD = new(big.Int).Sub(request.TD, request.Block.Difficulty()) ) // Update the peers total difficulty if better than the previous - if _, td := p.Head(); trueTD.Cmp(td) > 0 { + _, td := p.Head() + currentBlock := pm.blockchain.CurrentBlock() + currentTd := pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64()) + log.Debug("NewBlockMsg", "p", p, "number", request.Block.NumberU64(), "trueTD", trueTD, "td", td, "currentTd", currentTd) + if trueTD.Cmp(td) > 0 { p.SetHead(trueHead, trueTD) // Schedule a sync if above ours. Note, this will not fire a sync for a gap of // a singe block (as the true TD is below the propagated block), however this // scenario should easily be covered by the fetcher. - currentBlock := pm.blockchain.CurrentBlock() - if trueTD.Cmp(pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64())) > 0 { + if trueTD.Cmp(currentTd) > 0 { go pm.synchronise(p) } } @@ -705,7 +708,7 @@ func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool) { return } // Send the block to a subset of our peers - for _, peer := range peers { + for _, peer := range peers { peer.SendNewBlock(block, td) } log.Trace("Propagated block", "hash", hash, "recipients", len(peers), "duration", common.PrettyDuration(time.Since(block.ReceivedAt))) @@ -739,7 +742,7 @@ func (pm *ProtocolManager) BroadcastSpecialTx(hash common.Hash, tx *types.Transa for _, peer := range peers { peer.SendSpecialTransactions(tx) } - log.Debug("Broadcast special transaction", "hash", hash, "recipients", len(peers)) + log.Trace("Broadcast special transaction", "hash", hash, "recipients", len(peers)) } // Mined broadcast loop diff --git a/eth/sync.go b/eth/sync.go index e49e40087e..79c594f726 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -171,6 +171,7 @@ func (pm *ProtocolManager) synchronise(peer *peer) { td := pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64()) pHead, pTd := peer.Head() + log.Debug("ProtocolManager synchronise ", "p", peer, "pTd", pTd, "currentTd", td) if pTd.Cmp(td) <= 0 { return }