Skip to content

Commit

Permalink
[net processing] Ensure transaction announcements are only queued for…
Browse files Browse the repository at this point in the history
… fully connected peers

Github-Pull: #26569
Rebased-From: 845e3a3
  • Loading branch information
dergoegge authored and fanquake committed Dec 2, 2022
1 parent 95fded1 commit e15b306
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e15b306

Please sign in to comment.