Refactor: move GetValueIn(tx) to tx.GetValueIn()

GetValueIn makes more sense as a CTransaction member.
This commit is contained in:
Gavin Andresen
2013-11-11 16:03:51 +10:00
parent 98c7c8fd1d
commit 0733c1bde6
10 changed files with 33 additions and 36 deletions

View File

@@ -14,6 +14,10 @@
class CTransaction;
/** No amount larger than this (in satoshi) is valid */
static const int64_t MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(int64_t nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
/** An outpoint - a combination of a transaction hash and an index n into its vout */
class COutPoint
{
@@ -217,6 +221,11 @@ public:
uint256 GetHash() const;
bool IsNewerThan(const CTransaction& old) const;
// Return sum of txouts.
int64_t GetValueOut() const;
// GetValueIn() is a method on CCoinsViewCache, because
// inputs must be known to compute value in.
bool IsCoinBase() const
{
return (vin.size() == 1 && vin[0].prevout.IsNull());