aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2019-04-22 12:10:16 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2019-04-26 09:31:29 -0400
commit23163b759354b84c5a076e3e2ae6ae6338106035 (patch)
tree44da565b74c90b224afac37d70c35ade4a69fb78 /src/net_processing.cpp
parent218697b645b23249c16afa29b4ada20c1739c502 (diff)
downloadbitcoin-23163b759354b84c5a076e3e2ae6ae6338106035.tar.xz
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).
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index f76e5d64a0..f114981cc7 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -699,7 +699,9 @@ void UpdateTxRequestTime(const uint256& txid, int64_t request_time) EXCLUSIVE_LO
void RequestTx(CNodeState* state, const uint256& txid, int64_t nNow) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
CNodeState::TxDownloadState& peer_download_state = state->m_tx_download;
- if (peer_download_state.m_tx_announced.size() >= MAX_PEER_TX_ANNOUNCEMENTS || peer_download_state.m_tx_announced.count(txid)) {
+ if (peer_download_state.m_tx_announced.size() >= MAX_PEER_TX_ANNOUNCEMENTS ||
+ peer_download_state.m_tx_process_time.size() >= MAX_PEER_TX_ANNOUNCEMENTS ||
+ peer_download_state.m_tx_announced.count(txid)) {
// Too many queued announcements from this peer, or we already have
// this announcement
return;