inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
+inline bool MoneyRange(CBigNum nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
// Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.
static const unsigned int LOCKTIME_THRESHOLD = 500000000; // Tue Nov 5 00:53:20 1985 UTC
// Maximum number of script-checking threads allowed
const CBlockIndex* GetLastBlockIndex(const CBlockIndex* pindex, bool fProofOfStake);
void ResendWalletTransactions(bool fForceResend=false);
-bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType);
+bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, uint32_t nIn, unsigned int flags, int nHashType);
uint32_t n;
CInPoint() { SetNull(); }
- CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; }
+ CInPoint(CTransaction* ptxIn, uint32_t nIn) { ptx = ptxIn; n = nIn; }
void SetNull() { ptx = NULL; n = numeric_limits<uint32_t>::max(); }
bool IsNull() const { return (ptx == NULL && n == numeric_limits<uint32_t>::max()); }
};
uint32_t n;
COutPoint() { SetNull(); }
- COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; }
+ COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; }
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); )
void SetNull() { hash = 0; n = numeric_limits<uint32_t>::max(); }
bool IsNull() const { return (hash == 0 && n == numeric_limits<uint32_t>::max()); }
*/
int64_t GetValueOut() const
{
- int64_t nValueOut = 0;
- for(const CTxOut& txout : vout)
+ CBigNum nValueOut = 0;
+ for(const auto& txout : vout)
{
nValueOut += txout.nValue;
if (!MoneyRange(txout.nValue) || !MoneyRange(nValueOut))
throw runtime_error("CTransaction::GetValueOut() : value out of range");
}
- return nValueOut;
+ return nValueOut.getint64();
}
/** Amount of bitcoins coming in to this transaction
const CTxOut& GetOutputFor(const CTxIn& input, const MapPrevTx& inputs) const;
};
-/** Closure representing one script verification
- * Note that this stores references to the spending transaction */
-class CScriptCheck
-{
-private:
- CScript scriptPubKey;
- const CTransaction *ptxTo;
- unsigned int nIn;
- unsigned int nFlags;
- int nHashType;
-
-public:
- CScriptCheck() {}
- CScriptCheck(const CTransaction& txFromIn, const CTransaction& txToIn, unsigned int nInIn, unsigned int nFlagsIn, int nHashTypeIn) :
- scriptPubKey(txFromIn.vout[txToIn.vin[nInIn].prevout.n].scriptPubKey),
- ptxTo(&txToIn), nIn(nInIn), nFlags(nFlagsIn), nHashType(nHashTypeIn) { }
-
- bool operator()() const;
-
- void swap(CScriptCheck &check) {
- scriptPubKey.swap(check.scriptPubKey);
- std::swap(ptxTo, check.ptxTo);
- std::swap(nIn, check.nIn);
- std::swap(nFlags, check.nFlags);
- std::swap(nHashType, check.nHashType);
- }
-};
-