aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-07-27 15:55:25 +0100
committerglozow <gloriajzhao@gmail.com>2021-09-02 16:23:27 +0100
commit3f033f01a6b0f7772ae1b21044903b8f4249ad08 (patch)
tree9827288b5d98a2d0aa8423ac14f5d835f0969b2e /src/validation.cpp
parent7b60c02b7d5e2ab12288393d2258873ebb26d811 (diff)
downloadbitcoin-3f033f01a6b0f7772ae1b21044903b8f4249ad08.tar.xz
MOVEONLY: check for disjoint conflicts and ancestors to policy/rbf
This checks that a transaction isn't trying to replace something it supposedly depends on.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 20970bceb8..710fe2d873 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -770,16 +770,8 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
// that we have the set of all ancestors we can detect this
// pathological case by making sure setConflicts and setAncestors don't
// intersect.
- for (CTxMemPool::txiter ancestorIt : setAncestors)
- {
- const uint256 &hashAncestor = ancestorIt->GetTx().GetHash();
- if (setConflicts.count(hashAncestor))
- {
- return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-spends-conflicting-tx",
- strprintf("%s spends conflicting transaction %s",
- hash.ToString(),
- hashAncestor.ToString()));
- }
+ if (const auto err_string{EntriesAndTxidsDisjoint(setAncestors, setConflicts, hash)}) {
+ return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-spends-conflicting-tx", *err_string);
}