From d9bec888f1c82f1f58cc821cac81da9c571b5fa5 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 1 Jun 2017 11:12:59 -0700 Subject: [PATCH] Use REJECT_DUPLICATE for already known and conflicted txn --- src/validation.cpp | 12 +++++++----- src/validation.h | 4 ---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/validation.cpp b/src/validation.cpp index de65839eef..33340dcc16 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -427,8 +427,9 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C return state.DoS(0, false, REJECT_NONSTANDARD, "non-final"); // is it already in the memory pool? - if (pool.exists(hash)) - return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool"); + if (pool.exists(hash)) { + return state.Invalid(false, REJECT_DUPLICATE, "txn-already-in-mempool"); + } // Check for conflicts with in-memory transactions std::set setConflicts; @@ -466,8 +467,9 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C } } } - if (fReplacementOptOut) - return state.Invalid(false, REJECT_CONFLICT, "txn-mempool-conflict"); + if (fReplacementOptOut) { + return state.Invalid(false, REJECT_DUPLICATE, "txn-mempool-conflict"); + } setConflicts.insert(ptxConflicting->GetHash()); } @@ -494,7 +496,7 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C if (!had_coin_in_cache) { coins_to_uncache.push_back(outpoint); } - return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-known"); + return state.Invalid(false, REJECT_DUPLICATE, "txn-already-known"); } } diff --git a/src/validation.h b/src/validation.h index 096fd0a9ee..5e25e50048 100644 --- a/src/validation.h +++ b/src/validation.h @@ -509,10 +509,6 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para static const unsigned int REJECT_INTERNAL = 0x100; /** Too high fee. Can not be triggered by P2P transactions */ static const unsigned int REJECT_HIGHFEE = 0x100; -/** Transaction is already known (either in mempool or blockchain) */ -static const unsigned int REJECT_ALREADY_KNOWN = 0x101; -/** Transaction conflicts with a transaction already known */ -static const unsigned int REJECT_CONFLICT = 0x102; /** Get block file info entry for one block file */ CBlockFileInfo* GetBlockFileInfo(size_t n);