MERGE-FIX: Update src/primitives/bitcoin/

This commit is contained in:
Steven Roose 2019-05-17 16:54:52 +01:00
parent f4889a5253
commit 39c2906dca
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
2 changed files with 10 additions and 8 deletions

View file

@ -55,7 +55,7 @@ uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::ve
else else
right = left; right = left;
// combine subhashes // combine subhashes
return Hash(BEGIN(left), END(left), BEGIN(right), END(right)); return Hash(left.begin(), left.end(), right.begin(), right.end());
} }
} }
@ -111,7 +111,7 @@ uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, uns
right = left; right = left;
} }
// and combine them before returning // and combine them before returning
return Hash(BEGIN(left), END(left), BEGIN(right), END(right)); return Hash(left.begin(), left.end(), right.begin(), right.end());
} }
} }

View file

@ -24,7 +24,9 @@ public:
uint256 hash; uint256 hash;
uint32_t n; uint32_t n;
COutPoint(): n((uint32_t) -1) { } static constexpr uint32_t NULL_INDEX = std::numeric_limits<uint32_t>::max();
COutPoint(): n(NULL_INDEX) { }
COutPoint(const uint256& hashIn, uint32_t nIn): hash(hashIn), n(nIn) { } COutPoint(const uint256& hashIn, uint32_t nIn): hash(hashIn), n(nIn) { }
ADD_SERIALIZE_METHODS; ADD_SERIALIZE_METHODS;
@ -35,8 +37,8 @@ public:
READWRITE(n); READWRITE(n);
} }
void SetNull() { hash.SetNull(); n = (uint32_t) -1; } void SetNull() { hash.SetNull(); n = NULL_INDEX; }
bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); } bool IsNull() const { return (hash.IsNull() && n == NULL_INDEX); }
friend bool operator<(const COutPoint& a, const COutPoint& b) friend bool operator<(const COutPoint& a, const COutPoint& b)
{ {
@ -67,7 +69,7 @@ public:
COutPoint prevout; COutPoint prevout;
CScript scriptSig; CScript scriptSig;
uint32_t nSequence; uint32_t nSequence;
CScriptWitness scriptWitness; //! Only serialized through CTransaction CScriptWitness scriptWitness; //!< Only serialized through CTransaction
/* Setting nSequence to this value for every input in a transaction /* Setting nSequence to this value for every input in a transaction
* disables nLockTime. */ * disables nLockTime. */
@ -76,7 +78,7 @@ public:
/* Below flags apply in the context of BIP 68*/ /* Below flags apply in the context of BIP 68*/
/* If this flag set, CTxIn::nSequence is NOT interpreted as a /* If this flag set, CTxIn::nSequence is NOT interpreted as a
* relative lock-time. */ * relative lock-time. */
static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31); static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = (1U << 31);
/* If CTxIn::nSequence encodes a relative lock-time and this flag /* If CTxIn::nSequence encodes a relative lock-time and this flag
* is set, the relative lock-time has units of 512 seconds, * is set, the relative lock-time has units of 512 seconds,
@ -299,7 +301,7 @@ public:
CTransaction(); CTransaction();
/** Convert a CMutableTransaction into a CTransaction. */ /** Convert a CMutableTransaction into a CTransaction. */
CTransaction(const CMutableTransaction &tx); explicit CTransaction(const CMutableTransaction &tx);
CTransaction(CMutableTransaction &&tx); CTransaction(CMutableTransaction &&tx);
template <typename Stream> template <typename Stream>