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-09-07 16:42:41 +0200
commitb8c79a057c48c871a5e48bdcdf600fbfe68f656b (patch)
tree952520d17bc5e231361bab33489175497ecd4a52 /src/main.h
parenta9874310c0f67c80a1f04854c5c9ed154e1bbf97 (diff)
downloadbitcoin-b8c79a057c48c871a5e48bdcdf600fbfe68f656b.tar.xz
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 631dc00d05..cbce34290a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -39,6 +39,7 @@ class CTxMemPool;
class CValidationInterface;
class CValidationState;
+struct PrecomputedTransactionData;
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, PrecomputedTransactionData& txdata, 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);
@@ -408,12 +409,13 @@ private:
unsigned int nFlags;
bool cacheStore;
ScriptError error;
+ PrecomputedTransactionData *txdata;
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, PrecomputedTransactionData* txdataIn) :
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), txdata(txdataIn) { }
bool operator()();
@@ -425,6 +427,7 @@ public:
std::swap(nFlags, check.nFlags);
std::swap(cacheStore, check.cacheStore);
std::swap(error, check.error);
+ std::swap(txdata, check.txdata);
}
ScriptError GetScriptError() const { return error; }