aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-08-17 10:35:57 +0100
committerfanquake <fanquake@gmail.com>2023-08-17 10:52:06 +0100
commita62f5ee86c3959d5e3dd6e2d4a5ac1535b8a0109 (patch)
tree9dc9d8405cdb470774e90d1880ec13dcd815847a /src/txmempool.h
parent60d3e4b0cd8716a6fe1be6b4d1b8237da8e56126 (diff)
parentfb02ba3c5f5bcd96b5e3622ef001b8e57ce63fc0 (diff)
downloadbitcoin-a62f5ee86c3959d5e3dd6e2d4a5ac1535b8a0109.tar.xz
Merge bitcoin/bitcoin#27675: p2p: Drop m_recently_announced_invs bloom filter
fb02ba3c5f5bcd96b5e3622ef001b8e57ce63fc0 mempool_entry: improve struct packing (Anthony Towns) 1a118062fbc4ec8f645f4ec4298d869a869c3344 net_processing: Clean up INVENTORY_BROADCAST_MAX constants (Anthony Towns) 6fa49937e488d0924044786c76b42324b659f351 test: Check tx from disconnected block is immediately requestable (glozow) e4ffabbffacc4b890d393aafcc8286916ef887d8 net_processing: don't add txids to m_tx_inventory_known_filter (Anthony Towns) 6ec1809d33bfc42b80cb6f35625dccd56be8d507 net_processing: drop m_recently_announced_invs bloom filter (Anthony Towns) a70beafdb22564043dc24fc98133fdadbaf77d8a validation: when adding txs due to a block reorg, allow immediate relay (Anthony Towns) 1e9684f39fba909b3501e9402d5b61f4bf744ff2 mempool_entry: add mempool entry sequence number (Anthony Towns) Pull request description: This PR replaces the `m_recently_announced_invs` bloom filter with a simple sequence number tracking the mempool state when we last considered sending an INV message to a node. This saves 33kB per peer (or more if we raise the rate at which we relay transactions over the network, in which case we would need to increase the size of the bloom filter proportionally). The philosophy here (compare with #18861 and #19109) is that we consider the rate limiting on INV messages to only be about saving bandwidth and not protecting privacy, and therefore after you receive an INV message, it's immediately fair game to request any transaction that was in the mempool at the time the INV message was sent. We likewise consider the BIP 133 feefilter and BIP 37 bloom filters to be bandwidth optimisations here, and treat transactions as requestable if they would have been announced without those filters. Given that philosophy, tracking the timestamp of the last INV message and comparing that against the mempool entry time allows removal of each of `m_recently_announced_invs`, `m_last_mempool_req` and `UNCONDITIONAL_RELAY_DELAY` and associated logic. ACKs for top commit: naumenkogs: ACK fb02ba3c5f5bcd96b5e3622ef001b8e57ce63fc0 amitiuttarwar: review ACK fb02ba3c5f5 glozow: reACK fb02ba3c5f5bcd96b5e3622ef001b8e57ce63fc0 Tree-SHA512: cbba5ee04c86df26b6057f3654c00a2b45ec94d354f4f157a769cecdaa0b509edaac02b3128afba39b023e82473fc5e28c915a787f84457ffe66638c6ac9c2d4
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index fa1dbbf4b5..4d7d53ff68 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -708,6 +708,10 @@ public:
return mapTx.project<0>(mapTx.get<index_by_wtxid>().find(wtxid));
}
TxMempoolInfo info(const GenTxid& gtxid) const;
+
+ /** Returns info for a transaction if its entry_sequence < last_sequence */
+ TxMempoolInfo info_for_relay(const GenTxid& gtxid, uint64_t last_sequence) const;
+
std::vector<TxMempoolInfo> infoAll() const;
size_t DynamicMemoryUsage() const;