mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge #10682: Trivial: Move the AreInputsStandard documentation next to its implementation
ca67ddf0b
Move the AreInputsStandard documentation next to its implementation (esneider)
Pull request description:
The documentation (and rationale) for `AreInputsStandard` somehow got separated from its implementation, and creates a bit of confusion: it's in the middle of the file, next to the implementation of `IsStandard`, which actually checks the "standardness" of outputs, not inputs.
Tree-SHA512: 71281cbcbc5a5701cc11e812a3e90669dda3d92dc2176b512b7832d79b08b34307999c984516bb0c56b01db9b03a12ee4755f662efc1158f4e126de5ca421999
This commit is contained in:
commit
2a56baf395
@ -54,23 +54,6 @@ bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
|
||||
return (txout.nValue < GetDustThreshold(txout, dustRelayFeeIn));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check transaction inputs to mitigate two
|
||||
* potential denial-of-service attacks:
|
||||
*
|
||||
* 1. scriptSigs with extra data stuffed into them,
|
||||
* not consumed by scriptPubKey (or P2SH script)
|
||||
* 2. P2SH scripts with a crazy number of expensive
|
||||
* CHECKSIG/CHECKMULTISIG operations
|
||||
*
|
||||
* Why bother? To avoid denial-of-service attacks; an attacker
|
||||
* can submit a standard HASH... OP_EQUAL transaction,
|
||||
* which will get accepted into blocks. The redemption
|
||||
* script can be anything; an attacker could use a very
|
||||
* expensive-to-check-upon-redemption script like:
|
||||
* DUP CHECKSIG DROP ... repeated 100 times... OP_1
|
||||
*/
|
||||
|
||||
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled)
|
||||
{
|
||||
std::vector<std::vector<unsigned char> > vSolutions;
|
||||
@ -160,6 +143,22 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check transaction inputs to mitigate two
|
||||
* potential denial-of-service attacks:
|
||||
*
|
||||
* 1. scriptSigs with extra data stuffed into them,
|
||||
* not consumed by scriptPubKey (or P2SH script)
|
||||
* 2. P2SH scripts with a crazy number of expensive
|
||||
* CHECKSIG/CHECKMULTISIG operations
|
||||
*
|
||||
* Why bother? To avoid denial-of-service attacks; an attacker
|
||||
* can submit a standard HASH... OP_EQUAL transaction,
|
||||
* which will get accepted into blocks. The redemption
|
||||
* script can be anything; an attacker could use a very
|
||||
* expensive-to-check-upon-redemption script like:
|
||||
* DUP CHECKSIG DROP ... repeated 100 times... OP_1
|
||||
*/
|
||||
bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
|
||||
{
|
||||
if (tx.IsCoinBase())
|
||||
|
Loading…
Reference in New Issue
Block a user