diff options
author | glozow <gzhao408@berkeley.edu> | 2021-06-14 10:18:47 +0100 |
---|---|---|
committer | glozow <gzhao408@berkeley.edu> | 2021-07-08 09:31:45 +0100 |
commit | fdb48163bfbf34f79dc78ffaa2bbf9e39af96687 (patch) | |
tree | 9b4da57d1a09ac5ad00cd24a6fcc952d788b4b35 /src | |
parent | 4129134e844f78a89f8515cf30dad4b6074703c7 (diff) | |
download | bitcoin-fdb48163bfbf34f79dc78ffaa2bbf9e39af96687.tar.xz |
[validation] distinguish same txid different wtxid in mempool
Changes behavior.
Diffstat (limited to 'src')
-rw-r--r-- | src/validation.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 65d2dfa3b7..c80f015143 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -587,9 +587,13 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws) if (!CheckFinalTx(m_active_chainstate.m_chain.Tip(), tx, STANDARD_LOCKTIME_VERIFY_FLAGS)) return state.Invalid(TxValidationResult::TX_PREMATURE_SPEND, "non-final"); - // is it already in the memory pool? - if (m_pool.exists(hash)) { + if (m_pool.exists(GenTxid(true, tx.GetWitnessHash()))) { + // Exact transaction already exists in the mempool. return state.Invalid(TxValidationResult::TX_CONFLICT, "txn-already-in-mempool"); + } else if (m_pool.exists(GenTxid(false, tx.GetHash()))) { + // Transaction with the same non-witness data but different witness (same txid, different + // wtxid) already exists in the mempool. + return state.Invalid(TxValidationResult::TX_CONFLICT, "txn-same-nonwitness-data-in-mempool"); } // Check for conflicts with in-memory transactions |