Skip to content

Commit 7945192

Browse files
committed
Enforce IX locks from the new system
1 parent dc97835 commit 7945192

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/validation.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "evo/deterministicmns.h"
4747
#include "evo/cbtx.h"
4848

49+
#include "llmq/quorums_instantsend.h"
4950
#include "llmq/quorums_chainlocks.h"
5051

5152
#include <atomic>
@@ -692,6 +693,18 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
692693
REJECT_INVALID, "tx-txlock-conflict");
693694
}
694695

696+
uint256 txConflictHash;
697+
if (llmq::quorumInstantSendManager->GetConflictingTx(tx, txConflictHash)) {
698+
CTransactionRef txConflict;
699+
uint256 hashBlock;
700+
if (GetTransaction(txConflictHash, txConflict, Params().GetConsensus(), hashBlock)) {
701+
GetMainSignals().NotifyInstantSendDoubleSpendAttempt(tx, *txConflict);
702+
}
703+
return state.DoS(10, error("AcceptToMemoryPool : Transaction %s conflicts with locked TX %s",
704+
hash.ToString(), txConflictHash.ToString()),
705+
REJECT_INVALID, "tx-txlock-conflict");
706+
}
707+
695708
// Check for conflicts with in-memory transactions
696709
{
697710
LOCK(pool.cs); // protect pool.mapNextTx
@@ -3278,6 +3291,15 @@ bool CheckBlock(const CBlock& block, CValidationState& state, const Consensus::P
32783291
strprintf("transaction %s conflicts with transaction lock %s", tx->GetHash().ToString(), hashLocked.ToString()));
32793292
}
32803293
}
3294+
uint256 txConflict;
3295+
if (llmq::quorumInstantSendManager->GetConflictingTx(*tx, txConflict)) {
3296+
// The node which relayed this will have to switch later,
3297+
// relaying instantsend data won't help it.
3298+
LOCK(cs_main);
3299+
mapRejectedBlocks.insert(std::make_pair(block.GetHash(), GetTime()));
3300+
return state.DoS(100, false, REJECT_INVALID, "conflict-tx-lock", false,
3301+
strprintf("transaction %s conflicts with transaction lock %s", tx->GetHash().ToString(), txConflict.ToString()));
3302+
}
32813303
}
32823304
} else {
32833305
LogPrintf("CheckBlock(DASH): spork is off, skipping transaction locking checks\n");

0 commit comments

Comments
 (0)