Skip to content

Commit 23163b7

Browse files
committed
Add an explicit memory bound to m_tx_process_time
Previously there was an implicit bound based on the handling of m_tx_announced, but that approach is error-prone (particularly if we start automatically removing things from that set).
1 parent 218697b commit 23163b7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/net_processing.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,9 @@ void UpdateTxRequestTime(const uint256& txid, int64_t request_time) EXCLUSIVE_LO
699699
void RequestTx(CNodeState* state, const uint256& txid, int64_t nNow) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
700700
{
701701
CNodeState::TxDownloadState& peer_download_state = state->m_tx_download;
702-
if (peer_download_state.m_tx_announced.size() >= MAX_PEER_TX_ANNOUNCEMENTS || peer_download_state.m_tx_announced.count(txid)) {
702+
if (peer_download_state.m_tx_announced.size() >= MAX_PEER_TX_ANNOUNCEMENTS ||
703+
peer_download_state.m_tx_process_time.size() >= MAX_PEER_TX_ANNOUNCEMENTS ||
704+
peer_download_state.m_tx_announced.count(txid)) {
703705
// Too many queued announcements from this peer, or we already have
704706
// this announcement
705707
return;

0 commit comments

Comments
 (0)