Skip to content

Commit ca67ddf

Browse files
committed
Move the AreInputsStandard documentation next to its implementation
1 parent 7c87a9c commit ca67ddf

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/policy/policy.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,6 @@ bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
5252
return (txout.nValue < GetDustThreshold(txout, dustRelayFeeIn));
5353
}
5454

55-
/**
56-
* Check transaction inputs to mitigate two
57-
* potential denial-of-service attacks:
58-
*
59-
* 1. scriptSigs with extra data stuffed into them,
60-
* not consumed by scriptPubKey (or P2SH script)
61-
* 2. P2SH scripts with a crazy number of expensive
62-
* CHECKSIG/CHECKMULTISIG operations
63-
*
64-
* Why bother? To avoid denial-of-service attacks; an attacker
65-
* can submit a standard HASH... OP_EQUAL transaction,
66-
* which will get accepted into blocks. The redemption
67-
* script can be anything; an attacker could use a very
68-
* expensive-to-check-upon-redemption script like:
69-
* DUP CHECKSIG DROP ... repeated 100 times... OP_1
70-
*/
71-
7255
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType, const bool witnessEnabled)
7356
{
7457
std::vector<std::vector<unsigned char> > vSolutions;
@@ -158,6 +141,22 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason, const bool witnes
158141
return true;
159142
}
160143

144+
/**
145+
* Check transaction inputs to mitigate two
146+
* potential denial-of-service attacks:
147+
*
148+
* 1. scriptSigs with extra data stuffed into them,
149+
* not consumed by scriptPubKey (or P2SH script)
150+
* 2. P2SH scripts with a crazy number of expensive
151+
* CHECKSIG/CHECKMULTISIG operations
152+
*
153+
* Why bother? To avoid denial-of-service attacks; an attacker
154+
* can submit a standard HASH... OP_EQUAL transaction,
155+
* which will get accepted into blocks. The redemption
156+
* script can be anything; an attacker could use a very
157+
* expensive-to-check-upon-redemption script like:
158+
* DUP CHECKSIG DROP ... repeated 100 times... OP_1
159+
*/
161160
bool AreInputsStandard(const CTransaction& tx, const CCoinsViewCache& mapInputs)
162161
{
163162
if (tx.IsCoinBase())

0 commit comments

Comments
 (0)