diff options
author | dergoegge <n.goeggi@gmail.com> | 2022-11-28 16:34:50 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2022-12-02 15:58:24 +0000 |
commit | e15b3060179f94962eff82f3ed87a1d26ef65c88 (patch) | |
tree | 57882eb5bc58fca6fba166aab3fdbd835278a444 /src/net_processing.cpp | |
parent | 95fded106979a523431863679107810db81ca4b3 (diff) | |
download | bitcoin-e15b3060179f94962eff82f3ed87a1d26ef65c88.tar.xz |
[net processing] Ensure transaction announcements are only queued for fully connected peers
Github-Pull: #26569
Rebased-From: 845e3a34c49abcc634b5a10ccdd6b10fb4fcf449
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index a6299be403..1b333eb0b7 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -2007,8 +2007,15 @@ void PeerManagerImpl::RelayTransaction(const uint256& txid, const uint256& wtxid auto tx_relay = peer.GetTxRelay(); if (!tx_relay) continue; - const uint256& hash{peer.m_wtxid_relay ? wtxid : txid}; LOCK(tx_relay->m_tx_inventory_mutex); + // Only queue transactions for announcement once the version handshake + // is completed. The time of arrival for these transactions is + // otherwise at risk of leaking to a spy, if the spy is able to + // distinguish transactions received during the handshake from the rest + // in the announcement. + if (tx_relay->m_next_inv_send_time == 0s) continue; + + const uint256& hash{peer.m_wtxid_relay ? wtxid : txid}; if (!tx_relay->m_tx_inventory_known_filter.contains(hash)) { tx_relay->m_tx_inventory_to_send.insert(hash); } |