From c87b957a32e03c09d410abadf661f87eb813bcdb Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 27 Apr 2017 10:37:33 -0400 Subject: Only pass things committed to by tx's witness hash to CScriptCheck This clarifies a bit more the ways in which the new script execution cache could break consensus in the future if additional data from the CCoins object were to be used as a part of script execution. After this change, any such consensus breaks should be very visible to reviewers, hopefully ensuring no such changes can be made. --- src/validation.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/validation.h') diff --git a/src/validation.h b/src/validation.h index b19c3ff4f7..8931cfc4d4 100644 --- a/src/validation.h +++ b/src/validation.h @@ -404,8 +404,8 @@ private: public: CScriptCheck(): amount(0), ptxTo(0), nIn(0), nFlags(0), cacheStore(false), error(SCRIPT_ERR_UNKNOWN_ERROR) {} - CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, PrecomputedTransactionData* txdataIn) : - scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), amount(txFromIn.vout[txToIn.vin[nInIn].prevout.n].nValue), + CScriptCheck(const CScript& scriptPubKeyIn, const CAmount amountIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, PrecomputedTransactionData* txdataIn) : + scriptPubKey(scriptPubKeyIn), amount(amountIn), ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), error(SCRIPT_ERR_UNKNOWN_ERROR), txdata(txdataIn) { } bool operator()(); -- cgit v1.2.3