From ecd348b2a7c6003ae66bbbbe7573c22b75deb85b Mon Sep 17 00:00:00 2001 From: David Hill Date: Sat, 19 Nov 2016 11:23:24 -0500 Subject: [PATCH] btcd: disable mempool requests if bloom filtering is disabled --- server.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server.go b/server.go index ac701409..375ec824 100644 --- a/server.go +++ b/server.go @@ -394,6 +394,15 @@ func (sp *serverPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) { // pool up to the maximum inventory allowed per message. When the peer has a // bloom filter loaded, the contents are filtered accordingly. func (sp *serverPeer) OnMemPool(_ *peer.Peer, msg *wire.MsgMemPool) { + // Only allow mempool requests if the server has bloom filtering + // enabled. + if sp.server.services&wire.SFNodeBloom != wire.SFNodeBloom { + peerLog.Debugf("peer %v sent mempool request with bloom "+ + "filtering disabled -- disconnecting", sp) + sp.Disconnect() + return + } + // A decaying ban score increase is applied to prevent flooding. // The ban score accumulates and passes the ban threshold if a burst of // mempool messages comes from a peer. The score decays each minute to