aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-08-23 16:57:10 +0100
committerglozow <gloriajzhao@gmail.com>2021-11-29 15:46:48 +0000
commite12fafda2dfbbdf63f125e5af797ecfaa6488f66 (patch)
tree35bb2be46723a36f0cd474e53cc74c887c623447 /src/rpc/rawtransaction.cpp
parent8310d942e046c5a9b6bd90afdcd3af68dd91e081 (diff)
downloadbitcoin-e12fafda2dfbbdf63f125e5af797ecfaa6488f66.tar.xz
[validation] de-duplicate package transactions already in mempool
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. We definitely don't want to reject the entire package in that case (as that could be a censorship vector). We should still return the successful result to the caller, so add another result type to MempoolAcceptResult.
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
-rw-r--r--src/rpc/rawtransaction.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index fd18d4c96d..12d59690a3 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -974,6 +974,8 @@ static RPCHelpMan testmempoolaccept()
continue;
}
const auto& tx_result = it->second;
+ // Package testmempoolaccept doesn't allow transactions to already be in the mempool.
+ CHECK_NONFATAL(tx_result.m_result_type != MempoolAcceptResult::ResultType::MEMPOOL_ENTRY);
if (tx_result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
const CAmount fee = tx_result.m_base_fees.value();
// Check that fee does not exceed maximum fee