From 9a30e95d83b9e522ac2fcabe22941a0096350d55 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 4 Jul 2017 14:08:08 -0700 Subject: [PATCH] peer: don't inv trickle new blocks --- peer/peer.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/peer/peer.go b/peer/peer.go index 74b4b527..9a06774b 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -1723,7 +1723,19 @@ out: case iv := <-p.outputInvChan: // No handshake? They'll find out soon enough. if p.VersionKnown() { - invSendQueue.PushBack(iv) + // If this is a new block, then we'll blast it + // out immediately, sipping the inv trickle + // queue. + if iv.Type == wire.InvTypeBlock || + iv.Type == wire.InvTypeWitnessBlock { + + invMsg := wire.NewMsgInvSizeHint(1) + invMsg.AddInvVect(iv) + waiting = queuePacket(outMsg{msg: invMsg}, + pendingMsgs, waiting) + } else { + invSendQueue.PushBack(iv) + } } case <-trickleTicker.C: