diff --git a/consensus/posv/posv.go b/consensus/posv/posv.go index 06c185b215..6c2bf91b3d 100644 --- a/consensus/posv/posv.go +++ b/consensus/posv/posv.go @@ -742,7 +742,7 @@ func (c *Posv) Prepare(chain consensus.ChainReader, header *types.Header) error c.lock.RUnlock() } // Set the correct difficulty - header.Difficulty = CalcDifficulty(snap, c.signer) + header.Difficulty = big.NewInt(1) // Ensure the extra data has all it's components if len(header.Extra) < extraVanity { diff --git a/core/tx_pool.go b/core/tx_pool.go index ea281a65df..cba15d06c5 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -828,7 +828,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 4b748c9d1d..dbb7de94d4 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 8cffb7c8f8..181ffa704e 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -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) } } @@ -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..89f1f15c51 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -169,8 +169,8 @@ func (pm *ProtocolManager) synchronise(peer *peer) { // Make sure the peer's TD is higher than our own currentBlock := pm.blockchain.CurrentBlock() 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 }