Skip to content

Commit 406243e

Browse files
committed
Support overriding txn-spk-reused rejections via sendrawtransaction
1 parent a711269 commit 406243e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/validation.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
842842
}
843843

844844
auto spk_reuse_mode = SpkReuseMode;
845+
if (ignore_rejects.count("txn-spk-reused")) {
846+
spk_reuse_mode = SRM_ALLOW;
847+
}
845848
SPKStates_t mapSPK;
846849

847850
// Check for conflicts with in-memory transactions
@@ -897,7 +900,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
897900
}
898901
}
899902
if (mapSPK.find(hashSPK) != mapSPK.end()) {
900-
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "txn-spk-reused-twinoutputs");
903+
MaybeReject(TxValidationResult::TX_MEMPOOL_POLICY, "txn-spk-reused-twinoutputs");
901904
}
902905
mapSPK[hashSPK] = MemPool_SPK_State(mapSPK[hashSPK] | MSS_CREATED);
903906
}
@@ -963,7 +966,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
963966
SPKStates_t::iterator mssit = mapSPK.find(hashSPK);
964967
if (mssit != mapSPK.end()) {
965968
if (mssit->second & MSS_CREATED) {
966-
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "txn-spk-reused-change");
969+
MaybeReject(TxValidationResult::TX_MEMPOOL_POLICY, "txn-spk-reused-change");
967970
}
968971
}
969972
const auto& SPKit = m_pool.mapUsedSPK.find(hashSPK);
@@ -1161,7 +1164,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
11611164
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-spends-conflicting-tx", *err_string);
11621165
}
11631166
if (has_policy_conflict) {
1164-
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "txn-spk-reused-chained");
1167+
MaybeReject(TxValidationResult::TX_MEMPOOL_POLICY, "txn-spk-reused-chained");
11651168
}
11661169

11671170
// We want to detect conflicts in any tx in a package to trigger package RBF logic

0 commit comments

Comments
 (0)