Skip to content

Commit 5624724

Browse files
author
Antoine Riard
committed
[script] Comment PrecomputedTransactionData purpose
For the verification of each signature, amount of data hashing is proportional to the size of the transaction. To avoid hashing grows in O(n^2) as the number of sigops in a transaction increases, cache transaction digest invariant across signature verification.
1 parent f63dec1 commit 5624724

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/script/interpreter.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ enum
118118

119119
bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror);
120120

121+
/** "Midstate" hashes cache.
122+
*
123+
* As some limbs of signature message are invariant to sigops
124+
* evaluation, cache them to avoid performance hit and DoS vector
125+
* See BIP143, CVE-2013-2292 for more information
126+
*/
121127
struct PrecomputedTransactionData
122128
{
123129
uint256 hashPrevouts, hashSequence, hashOutputs;

0 commit comments

Comments
 (0)