aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-12-17 14:18:02 +0000
committerglozow <gloriajzhao@gmail.com>2022-01-17 12:17:51 +0000
commit9ad211c5753dbd148ba6f0ed56854f6364362ca8 (patch)
tree4755a3e6265226be87b82c429e9edbbace1b2ad4 /src/validation.cpp
parent83d4fb71260f268abd41d083fb3458476aed83ce (diff)
downloadbitcoin-9ad211c5753dbd148ba6f0ed56854f6364362ca8.tar.xz
[doc] more detailed explanation for deduplication
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 616873057c..b48eb6ac3c 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1250,10 +1250,14 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
LOCK(m_pool.cs);
std::map<const uint256, const MempoolAcceptResult> results;
- // As node operators are free to set their mempool policies however they please, it's possible
- // for package transaction(s) to already be in the mempool, and we don't want to reject the
- // entire package in that case (as that could be a censorship vector). Filter the transactions
- // that are already in mempool and add their information to results, since we already have them.
+ // Node operators are free to set their mempool policies however they please, nodes may receive
+ // transactions in different orders, and malicious counterparties may try to take advantage of
+ // policy differences to pin or delay propagation of transactions. As such, it's possible for
+ // some package transaction(s) to already be in the mempool, and we don't want to reject the
+ // entire package in that case (as that could be a censorship vector). De-duplicate the
+ // transactions that are already in the mempool, and only call AcceptMultipleTransactions() with
+ // the new transactions. This ensures we don't double-count transaction counts and sizes when
+ // checking ancestor/descendant limits, or double-count transaction fees for fee-related policy.
std::vector<CTransactionRef> txns_new;
for (const auto& tx : package) {
const auto& wtxid = tx->GetWitnessHash();