Browse Source

Merge #10503: Use REJECT_DUPLICATE for already known and conflicted txn

d9bec888f Use REJECT_DUPLICATE for already known and conflicted txn (Pieter Wuille)

Tree-SHA512: adc6dc5caed731c3fd5c8784e8820a074e320360cdb5579c5b9299f9799dd99de60b7382d336ab1909dab8b23e744456d78aa0c3b1c8dd1af3d1b779314cf8fa
0.15
Pieter Wuille 8 years ago
parent
commit
efbcf2b1d5
No known key found for this signature in database
GPG Key ID: A636E97631F767E0
  1. 12
      src/validation.cpp
  2. 4
      src/validation.h

12
src/validation.cpp

@ -430,8 +430,9 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
return state.DoS(0, false, REJECT_NONSTANDARD, "non-final"); return state.DoS(0, false, REJECT_NONSTANDARD, "non-final");
// is it already in the memory pool? // is it already in the memory pool?
if (pool.exists(hash)) if (pool.exists(hash)) {
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool"); return state.Invalid(false, REJECT_DUPLICATE, "txn-already-in-mempool");
}
// Check for conflicts with in-memory transactions // Check for conflicts with in-memory transactions
std::set<uint256> setConflicts; std::set<uint256> setConflicts;
@ -469,8 +470,9 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
} }
} }
} }
if (fReplacementOptOut) if (fReplacementOptOut) {
return state.Invalid(false, REJECT_CONFLICT, "txn-mempool-conflict"); return state.Invalid(false, REJECT_DUPLICATE, "txn-mempool-conflict");
}
setConflicts.insert(ptxConflicting->GetHash()); setConflicts.insert(ptxConflicting->GetHash());
} }
@ -497,7 +499,7 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
if (!had_coin_in_cache) { if (!had_coin_in_cache) {
coins_to_uncache.push_back(outpoint); 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");
} }
} }

4
src/validation.h

@ -469,10 +469,6 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
static const unsigned int REJECT_INTERNAL = 0x100; static const unsigned int REJECT_INTERNAL = 0x100;
/** Too high fee. Can not be triggered by P2P transactions */ /** Too high fee. Can not be triggered by P2P transactions */
static const unsigned int REJECT_HIGHFEE = 0x100; 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 */ /** Get block file info entry for one block file */
CBlockFileInfo* GetBlockFileInfo(size_t n); CBlockFileInfo* GetBlockFileInfo(size_t n);

Loading…
Cancel
Save