Skip to content

Commit 2a56baf

Browse files
author
MarcoFalke
committed
Merge #10682: Trivial: Move the AreInputsStandard documentation next to its implementation
ca67ddf 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
2 parents f656147 + ca67ddf commit 2a56baf

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
@@ -54,23 +54,6 @@ bool IsDust(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
5454
return (txout.nValue < GetDustThreshold(txout, dustRelayFeeIn));
5555
}
5656

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

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

0 commit comments

Comments
 (0)