Page MenuHomePhabricator

D15283.id44631.diff
No OneTemporary

D15283.id44631.diff

diff --git a/src/consensus/validation.h b/src/consensus/validation.h
--- a/src/consensus/validation.h
+++ b/src/consensus/validation.h
@@ -32,12 +32,17 @@
//! transaction spends a coinbase too early, or violates locktime/sequence
//! locks
TX_PREMATURE_SPEND,
+ /** Tx already in mempool or in the chain. */
+ TX_DUPLICATE,
/**
- * Tx already in mempool or conflicts with a tx in the chain
- * Currently this is only used if the transaction already exists in the
- * mempool or on chain.
+ * Tx conflicts with another mempool tx, i.e. spends the same coin.
*/
TX_CONFLICT,
+ /**
+ * This tx outputs are already spent in the mempool. This should never
+ * happen and is a symptom of a mempool bug/corruption.
+ */
+ TX_CHILD_BEFORE_PARENT,
//! violated mempool's fee/size/descendant/etc limits
TX_MEMPOOL_POLICY,
//! this node does not have a mempool so can't validate the transaction
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2484,7 +2484,9 @@
case TxValidationResult::TX_NOT_STANDARD:
case TxValidationResult::TX_MISSING_INPUTS:
case TxValidationResult::TX_PREMATURE_SPEND:
+ case TxValidationResult::TX_DUPLICATE:
case TxValidationResult::TX_CONFLICT:
+ case TxValidationResult::TX_CHILD_BEFORE_PARENT:
case TxValidationResult::TX_MEMPOOL_POLICY:
case TxValidationResult::TX_NO_MEMPOOL:
break;
diff --git a/src/validation.cpp b/src/validation.cpp
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -522,7 +522,7 @@
// Is it already in the memory pool?
if (m_pool.exists(txid)) {
- return state.Invalid(TxValidationResult::TX_CONFLICT,
+ return state.Invalid(TxValidationResult::TX_DUPLICATE,
"txn-already-in-mempool");
}
@@ -531,7 +531,7 @@
auto itConflicting = m_pool.mapNextTx.find(txin.prevout);
if (itConflicting != m_pool.mapNextTx.end()) {
// Disable replacement feature for good
- return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY,
+ return state.Invalid(TxValidationResult::TX_CONFLICT,
"txn-mempool-conflict");
}
}
@@ -556,7 +556,7 @@
// Optimistically just do efficient check of cache for
// outputs.
if (coins_cache.HaveCoinInCache(COutPoint(txid, out))) {
- return state.Invalid(TxValidationResult::TX_CONFLICT,
+ return state.Invalid(TxValidationResult::TX_DUPLICATE,
"txn-already-known");
}
}
@@ -879,8 +879,8 @@
"its outputs are already spent in the "
"mempool\n",
__func__, txid.ToString());
- ws.m_state.Invalid(TxValidationResult::TX_CONFLICT,
- "txn-mempool-conflict");
+ ws.m_state.Invalid(TxValidationResult::TX_CHILD_BEFORE_PARENT,
+ "txn-child-before-parent");
return MempoolAcceptResult::Failure(ws.m_state);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Feb 6, 16:39 (17 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5082715
Default Alt Text
D15283.id44631.diff (3 KB)

Event Timeline