Skip to content

Commit 4581a68

Browse files
0xB10Cwillcl-ark
andcommitted
clarify processing of mempool-msgs when NODE_BLOOM
Under which circumstances we process received 'mempool' P2P messages caused confusion in #27426. Rather than bikeshedding the formulation of the IF-statement, this adds a comment clarifing when we process the message. Also, correcting the comment of `m_send_mempool`. Co-authored-by: willcl-ark <[email protected]>
1 parent da9f62f commit 4581a68

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/net_processing.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ struct Peer {
292292
* this does not have to be sorted. */
293293
std::set<uint256> m_tx_inventory_to_send GUARDED_BY(m_tx_inventory_mutex);
294294
/** Whether the peer has requested us to send our complete mempool. Only
295-
* permitted if the peer has NetPermissionFlags::Mempool. See BIP35. */
295+
* permitted if the peer has NetPermissionFlags::Mempool or we advertise
296+
* NODE_BLOOM. See BIP35. */
296297
bool m_send_mempool GUARDED_BY(m_tx_inventory_mutex){false};
297298
/** The last time a BIP35 `mempool` request was serviced. */
298299
std::atomic<std::chrono::seconds> m_last_mempool_req{0s};
@@ -4600,6 +4601,8 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
46004601
}
46014602

46024603
if (msg_type == NetMsgType::MEMPOOL) {
4604+
// Only process received mempool messages if we advertise NODE_BLOOM
4605+
// or if the peer has mempool permissions.
46034606
if (!(peer->m_our_services & NODE_BLOOM) && !pfrom.HasPermission(NetPermissionFlags::Mempool))
46044607
{
46054608
if (!pfrom.HasPermission(NetPermissionFlags::NoBan))

0 commit comments

Comments
 (0)