Skip to content

Commit d9bec88

Browse files
committed
Use REJECT_DUPLICATE for already known and conflicted txn
1 parent 7cc2c67 commit d9bec88

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/validation.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,9 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
427427
return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
428428

429429
// is it already in the memory pool?
430-
if (pool.exists(hash))
431-
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool");
430+
if (pool.exists(hash)) {
431+
return state.Invalid(false, REJECT_DUPLICATE, "txn-already-in-mempool");
432+
}
432433

433434
// Check for conflicts with in-memory transactions
434435
std::set<uint256> setConflicts;
@@ -466,8 +467,9 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
466467
}
467468
}
468469
}
469-
if (fReplacementOptOut)
470-
return state.Invalid(false, REJECT_CONFLICT, "txn-mempool-conflict");
470+
if (fReplacementOptOut) {
471+
return state.Invalid(false, REJECT_DUPLICATE, "txn-mempool-conflict");
472+
}
471473

472474
setConflicts.insert(ptxConflicting->GetHash());
473475
}
@@ -494,7 +496,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
494496
if (!had_coin_in_cache) {
495497
coins_to_uncache.push_back(outpoint);
496498
}
497-
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-known");
499+
return state.Invalid(false, REJECT_DUPLICATE, "txn-already-known");
498500
}
499501
}
500502

src/validation.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,6 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
509509
static const unsigned int REJECT_INTERNAL = 0x100;
510510
/** Too high fee. Can not be triggered by P2P transactions */
511511
static const unsigned int REJECT_HIGHFEE = 0x100;
512-
/** Transaction is already known (either in mempool or blockchain) */
513-
static const unsigned int REJECT_ALREADY_KNOWN = 0x101;
514-
/** Transaction conflicts with a transaction already known */
515-
static const unsigned int REJECT_CONFLICT = 0x102;
516512

517513
/** Get block file info entry for one block file */
518514
CBlockFileInfo* GetBlockFileInfo(size_t n);

0 commit comments

Comments
 (0)