Skip to content

Commit efbcf2b

Browse files
committed
Merge #10503: Use REJECT_DUPLICATE for already known and conflicted txn
d9bec88 Use REJECT_DUPLICATE for already known and conflicted txn (Pieter Wuille) Tree-SHA512: adc6dc5caed731c3fd5c8784e8820a074e320360cdb5579c5b9299f9799dd99de60b7382d336ab1909dab8b23e744456d78aa0c3b1c8dd1af3d1b779314cf8fa
2 parents b33ca14 + d9bec88 commit efbcf2b

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
@@ -430,8 +430,9 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
430430
return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
431431

432432
// is it already in the memory pool?
433-
if (pool.exists(hash))
434-
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool");
433+
if (pool.exists(hash)) {
434+
return state.Invalid(false, REJECT_DUPLICATE, "txn-already-in-mempool");
435+
}
435436

436437
// Check for conflicts with in-memory transactions
437438
std::set<uint256> setConflicts;
@@ -469,8 +470,9 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
469470
}
470471
}
471472
}
472-
if (fReplacementOptOut)
473-
return state.Invalid(false, REJECT_CONFLICT, "txn-mempool-conflict");
473+
if (fReplacementOptOut) {
474+
return state.Invalid(false, REJECT_DUPLICATE, "txn-mempool-conflict");
475+
}
474476

475477
setConflicts.insert(ptxConflicting->GetHash());
476478
}
@@ -497,7 +499,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
497499
if (!had_coin_in_cache) {
498500
coins_to_uncache.push_back(outpoint);
499501
}
500-
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-known");
502+
return state.Invalid(false, REJECT_DUPLICATE, "txn-already-known");
501503
}
502504
}
503505

src/validation.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,6 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
469469
static const unsigned int REJECT_INTERNAL = 0x100;
470470
/** Too high fee. Can not be triggered by P2P transactions */
471471
static const unsigned int REJECT_HIGHFEE = 0x100;
472-
/** Transaction is already known (either in mempool or blockchain) */
473-
static const unsigned int REJECT_ALREADY_KNOWN = 0x101;
474-
/** Transaction conflicts with a transaction already known */
475-
static const unsigned int REJECT_CONFLICT = 0x102;
476472

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

0 commit comments

Comments
 (0)