mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
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.
This commit is contained in:
parent
7b60c02b7d
commit
3f033f01a6
3 changed files with 32 additions and 10 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue