Skip to content

Commit df660dd

Browse files
committed
Update getpeerinfo/-netinfo/TxRelay#m_relay_txs relaytxes docs (for v24 backport)
to the current p2p behavior. We only initialize the Peer::TxRelay m_relay_txs data structure if it isn't an outbound block-relay-only connection and fRelay=true (the peer wishes to receive tx announcements) or we're offering NODE_BLOOM to this peer.
1 parent 1f44854 commit df660dd

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/bitcoin-cli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
642642
" send Time since last message sent to the peer, in seconds\n"
643643
" recv Time since last message received from the peer, in seconds\n"
644644
" txn Time since last novel transaction received from the peer and accepted into our mempool, in minutes\n"
645-
" \"*\" - the peer requested we not relay transactions to it (relaytxes is false)\n"
645+
" \"*\" - whether we relay transactions to this peer (relaytxes is false)\n"
646646
" blk Time since last novel block passing initial validity checks received from the peer, in minutes\n"
647647
" hb High-bandwidth BIP152 compact block relay\n"
648648
" \".\" (to) - we selected the peer as a high-bandwidth peer\n"

src/net_processing.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,7 @@ struct Peer {
271271

272272
struct TxRelay {
273273
mutable RecursiveMutex m_bloom_filter_mutex;
274-
/** Whether the peer wishes to receive transaction announcements.
275-
*
276-
* This is initially set based on the fRelay flag in the received
277-
* `version` message. If initially set to false, it can only be flipped
278-
* to true if we have offered the peer NODE_BLOOM services and it sends
279-
* us a `filterload` or `filterclear` message. See BIP37. */
274+
/** Whether we relay transactions to this peer. */
280275
bool m_relay_txs GUARDED_BY(m_bloom_filter_mutex){false};
281276
/** A bloom filter for which transactions to announce to the peer. See BIP37. */
282277
std::unique_ptr<CBloomFilter> m_bloom_filter PT_GUARDED_BY(m_bloom_filter_mutex) GUARDED_BY(m_bloom_filter_mutex){nullptr};
@@ -3247,10 +3242,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
32473242
}
32483243
peer->m_starting_height = starting_height;
32493244

3250-
// We only initialize the m_tx_relay data structure if:
3251-
// - this isn't an outbound block-relay-only connection; and
3252-
// - fRelay=true or we're offering NODE_BLOOM to this peer
3253-
// (NODE_BLOOM means that the peer may turn on tx relay later)
3245+
// We only initialize the Peer::TxRelay m_relay_txs data structure if:
3246+
// - this isn't an outbound block-relay-only connection, and
3247+
// - fRelay=true (the peer wishes to receive transaction announcements)
3248+
// or we're offering NODE_BLOOM to this peer. NODE_BLOOM means that
3249+
// the peer may turn on transaction relay later.
32543250
if (!pfrom.IsBlockOnlyConn() &&
32553251
(fRelay || (peer->m_our_services & NODE_BLOOM))) {
32563252
auto* const tx_relay = peer->SetTxRelay();

src/rpc/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static RPCHelpMan getpeerinfo()
114114
{
115115
{RPCResult::Type::STR, "SERVICE_NAME", "the service name if it is recognised"}
116116
}},
117-
{RPCResult::Type::BOOL, "relaytxes", /*optional=*/true, "Whether peer has asked us to relay transactions to it"},
117+
{RPCResult::Type::BOOL, "relaytxes", /*optional=*/true, "Whether we relay transactions to this peer"},
118118
{RPCResult::Type::NUM_TIME, "lastsend", "The " + UNIX_EPOCH_TIME + " of the last send"},
119119
{RPCResult::Type::NUM_TIME, "lastrecv", "The " + UNIX_EPOCH_TIME + " of the last receive"},
120120
{RPCResult::Type::NUM_TIME, "last_transaction", "The " + UNIX_EPOCH_TIME + " of the last valid transaction received from this peer"},

0 commit comments

Comments
 (0)