From bdc49c987f73b4e804d54cdb1531a963998141ec Mon Sep 17 00:00:00 2001 From: Mark Friedenbach Date: Thu, 9 Feb 2017 15:49:08 -0800 Subject: [PATCH] [Move Only] Put the asset definitions after COutPoint --- src/primitives/transaction.h | 80 ++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 1e1efe7deb..48f1dfb79e 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -96,6 +96,46 @@ private: // "Bitcoin amounts" can only be set by deserializing with SERIALIZE_BI void SetToAmount(const CAmount nAmount); }; +/** An outpoint - a combination of a transaction hash and an index n into its vout */ +class COutPoint +{ +public: + uint256 hash; + uint32_t n; + + COutPoint() { SetNull(); } + COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; } + + ADD_SERIALIZE_METHODS; + + template + inline void SerializationOp(Stream& s, Operation ser_action) { + READWRITE(hash); + READWRITE(n); + } + + void SetNull() { hash.SetNull(); n = (uint32_t) -1; } + bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); } + + friend bool operator<(const COutPoint& a, const COutPoint& b) + { + int cmp = a.hash.Compare(b.hash); + return cmp < 0 || (cmp == 0 && a.n < b.n); + } + + friend bool operator==(const COutPoint& a, const COutPoint& b) + { + return (a.hash == b.hash && a.n == b.n); + } + + friend bool operator!=(const COutPoint& a, const COutPoint& b) + { + return !(a == b); + } + + std::string ToString() const; +}; + class CAssetGeneration { public: @@ -146,46 +186,6 @@ public: // FIXME: constructor and methods }; -/** An outpoint - a combination of a transaction hash and an index n into its vout */ -class COutPoint -{ -public: - uint256 hash; - uint32_t n; - - COutPoint() { SetNull(); } - COutPoint(uint256 hashIn, uint32_t nIn) { hash = hashIn; n = nIn; } - - ADD_SERIALIZE_METHODS; - - template - inline void SerializationOp(Stream& s, Operation ser_action) { - READWRITE(hash); - READWRITE(n); - } - - void SetNull() { hash.SetNull(); n = (uint32_t) -1; } - bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); } - - friend bool operator<(const COutPoint& a, const COutPoint& b) - { - int cmp = a.hash.Compare(b.hash); - return cmp < 0 || (cmp == 0 && a.n < b.n); - } - - friend bool operator==(const COutPoint& a, const COutPoint& b) - { - return (a.hash == b.hash && a.n == b.n); - } - - friend bool operator!=(const COutPoint& a, const COutPoint& b) - { - return !(a == b); - } - - std::string ToString() const; -}; - /** An input of a transaction. It contains the location of the previous * transaction's output that it claims and a signature that matches the * output's public key.