Skip to content

Commit 5d01556

Browse files
committed
Check for known inventory before relaying compact block
1 parent d5ba436 commit 5d01556

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,12 +2274,12 @@ func (s *server) handleRelayInvMsg(state *peerState, msg relayMsg) {
22742274
// handleRelayCmpctBlock deals with direct relaying a compact block to
22752275
// peers which both want a compact block and accept direct relay.
22762276
func (s *server) handleRelayCmpctBlock(state *peerState, msg *wire.MsgCmpctBlock) {
2277+
blockHash := msg.BlockHash()
2278+
iv := wire.NewInvVect(wire.InvTypeBlock, &blockHash)
22772279
state.forAllPeers(func(sp *serverPeer) {
22782280
if sp.WantsCompactBlocks() && sp.WantsDirectBlockRelay() &&
2279-
sp.ProtocolVersion() >= wire.NoValidationRelayVersion {
2281+
sp.ProtocolVersion() >= wire.NoValidationRelayVersion && !sp.HasKnownInventory(iv) {
22802282

2281-
blockHash := msg.BlockHash()
2282-
iv := wire.NewInvVect(wire.InvTypeBlock, &blockHash)
22832283
sp.AddKnownInventory(iv)
22842284
sp.QueueMessage(msg, nil)
22852285
}

0 commit comments

Comments
 (0)