aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-08-16 15:35:45 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-08-16 15:35:45 +0200
commitd2c5d044d00ec805957ab246a7863d83ca075805 (patch)
tree154dd70f87cf7a91adeaa7658257c4faacf03e62 /src/main.h
parent2c2d471e18f0601c2767cf516425b2ecfcfd2126 (diff)
Precompute sighashes
Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.h b/src/main.h
index d4d70c0180..fbf66c0481 100644
--- a/src/main.h
+++ b/src/main.h
@@ -38,6 +38,7 @@ class CScriptCheck;
class CTxMemPool;
class CValidationInterface;
class CValidationState;
+class CachedHashes;
struct CNodeStateStats;
struct LockPoints;
@@ -347,7 +348,7 @@ int64_t GetTransactionSigOpCost(const CTransaction& tx, const CCoinsViewCache& i
* instead of being performed inline.
*/
bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsViewCache &view, bool fScriptChecks,
- unsigned int flags, bool cacheStore, std::vector<CScriptCheck> *pvChecks = NULL);
+ unsigned int flags, bool cacheStore, CachedHashes& cachedHashes, std::vector<CScriptCheck> *pvChecks = NULL);
/** Apply the effects of this transaction on the UTXO set represented by view */
void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight);
@@ -421,12 +422,13 @@ private:
unsigned int nFlags;
bool cacheStore;
ScriptError error;
+ CachedHashes *cachedHashes;
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) :
+ CScriptCheck(const CCoins& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, bool cacheIn, CachedHashes* cachedHashesIn) :
scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey), amount(txFromIn.vout[txToIn.vin[nInIn].prevout.n].nValue),
- ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), error(SCRIPT_ERR_UNKNOWN_ERROR) { }
+ ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), cacheStore(cacheIn), error(SCRIPT_ERR_UNKNOWN_ERROR), cachedHashes(cachedHashesIn) { }
bool operator()();
@@ -438,6 +440,7 @@ public:
std::swap(nFlags, check.nFlags);
std::swap(cacheStore, check.cacheStore);
std::swap(error, check.error);
+ std::swap(cachedHashes, check.cachedHashes);
}
ScriptError GetScriptError() const { return error; }