mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
Merge #19620: Add txids with non-standard inputs to reject filter
9f88ded82b2898ca63d44c08072f1ba52f0e18d7 test addition of unknown segwit spends to txid reject filter (Gregory Sanders) 7989901c7eb62ca28b3d1e5d5831041a7267e495 Add txids with non-standard inputs to reject filter (Suhas Daftuar) Pull request description: Our policy checks for non-standard inputs depend only on the non-witness portion of a transaction: we look up the scriptPubKey of the input being spent from our UTXO set (which is covered by the input txid), and the p2sh checks only rely on the scriptSig portion of the input. Consequently it's safe to add txids of transactions that fail these checks to the reject filter, as the witness is irrelevant to the failure. This is helpful for any situation where we might request the transaction again via txid (either from txid-relay peers, or if we might fetch the transaction via txid due to parent-fetching of orphans). Further, in preparation for future witness versions being deployed on the network, ensure that WITNESS_UNKNOWN transactions are rejected in AreInputsStandard(), so that transactions spending v1 (or greater) witness outputs will fall into this category of having their txid added to the reject filter. ACKs for top commit: ajtowns: ACK 9f88ded82b2898ca63d44c08072f1ba52f0e18d7 - code review jnewbery: Code review ACK 9f88ded82b2898ca63d44c08072f1ba52f0e18d7 ariard: Code Review/Tested ACK 9f88ded naumenkogs: utACK 9f88ded82b2898ca63d44c08072f1ba52f0e18d7 jonatack: ACK 9f88ded82b2 Tree-SHA512: 1e93c0a5b68cb432524780ffc0093db893911fdfed9e2ed17f888e59114cc75d2a07062aefad4e5ce2e87c9270886117a8abb3c78fb889c9b9f31967f1777148
This commit is contained in:
parent
0b0cc82819
commit
8ef196d9b8
@ -19,7 +19,8 @@ enum class TxValidationResult {
|
|||||||
*/
|
*/
|
||||||
// Only loose txn:
|
// Only loose txn:
|
||||||
TX_RECENT_CONSENSUS_CHANGE,
|
TX_RECENT_CONSENSUS_CHANGE,
|
||||||
TX_NOT_STANDARD, //!< didn't meet our local policy rules
|
TX_INPUTS_NOT_STANDARD, //!< inputs (covered by txid) failed policy rules
|
||||||
|
TX_NOT_STANDARD, //!< otherwise didn't meet our local policy rules
|
||||||
TX_MISSING_INPUTS, //!< transaction was missing some of its inputs
|
TX_MISSING_INPUTS, //!< transaction was missing some of its inputs
|
||||||
TX_PREMATURE_SPEND, //!< transaction spends a coinbase too early, or violates locktime/sequence locks
|
TX_PREMATURE_SPEND, //!< transaction spends a coinbase too early, or violates locktime/sequence locks
|
||||||
TX_BAD_SPECIAL, //!< special transaction violates some rules that are not enough for insta-ban
|
TX_BAD_SPECIAL, //!< special transaction violates some rules that are not enough for insta-ban
|
||||||
|
@ -1532,6 +1532,7 @@ bool PeerManagerImpl::MaybePunishNodeForTx(NodeId nodeid, const TxValidationStat
|
|||||||
}
|
}
|
||||||
// Conflicting (but not necessarily invalid) data or different policy:
|
// Conflicting (but not necessarily invalid) data or different policy:
|
||||||
case TxValidationResult::TX_RECENT_CONSENSUS_CHANGE:
|
case TxValidationResult::TX_RECENT_CONSENSUS_CHANGE:
|
||||||
|
case TxValidationResult::TX_INPUTS_NOT_STANDARD:
|
||||||
case TxValidationResult::TX_NOT_STANDARD:
|
case TxValidationResult::TX_NOT_STANDARD:
|
||||||
case TxValidationResult::TX_MISSING_INPUTS:
|
case TxValidationResult::TX_MISSING_INPUTS:
|
||||||
case TxValidationResult::TX_PREMATURE_SPEND:
|
case TxValidationResult::TX_PREMATURE_SPEND:
|
||||||
|
@ -765,8 +765,9 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for non-standard pay-to-script-hash in inputs
|
// Check for non-standard pay-to-script-hash in inputs
|
||||||
if (fRequireStandard && !AreInputsStandard(tx, m_view))
|
if (fRequireStandard && !AreInputsStandard(tx, m_view)) {
|
||||||
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, "bad-txns-nonstandard-inputs");
|
return state.Invalid(TxValidationResult::TX_INPUTS_NOT_STANDARD, "bad-txns-nonstandard-inputs");
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int nSigOps = GetTransactionSigOpCount(tx, m_view, STANDARD_SCRIPT_VERIFY_FLAGS);
|
unsigned int nSigOps = GetTransactionSigOpCount(tx, m_view, STANDARD_SCRIPT_VERIFY_FLAGS);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user