aboutsummaryrefslogtreecommitdiff
path: root/src/main.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-03-31 14:51:29 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-06-22 15:43:00 +0200
commit0ef1dd3e11dd573b6e443852ef0c72e34093ac68 (patch)
tree5fb4e54e732902ea296636877f2cd81dfd4f4b29 /src/main.h
parentb8a97498df1e83f8dcc49bc3fa4344f9e9799242 (diff)
downloadbitcoin-0ef1dd3e11dd573b6e443852ef0c72e34093ac68.tar.xz
Refactor script validation to observe amounts
This is a preparation for BIP143 support.
Diffstat (limited to 'src/main.h')
-rw-r--r--src/main.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.h b/src/main.h
index d0dce70687..6dd4b1aa3d 100644
--- a/src/main.h
+++ b/src/main.h
@@ -394,6 +394,7 @@ class CScriptCheck
{
private:
CScript scriptPubKey;
+ CAmount amount;
const CTransaction *ptxTo;
unsigned int nIn;
unsigned int nFlags;
@@ -401,9 +402,9 @@ private:
ScriptError error;
public:
- CScriptCheck(): ptxTo(0), nIn(0), nFlags(0), cacheStore(false), error(SCRIPT_ERR_UNKNOWN_ERROR) {}
+ 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) :
- scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey),
+ 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) { }
bool operator()();
@@ -411,6 +412,7 @@ public:
void swap(CScriptCheck &check) {
scriptPubKey.swap(check.scriptPubKey);
std::swap(ptxTo, check.ptxTo);
+ std::swap(amount, check.amount);
std::swap(nIn, check.nIn);
std::swap(nFlags, check.nFlags);
std::swap(cacheStore, check.cacheStore);