Skip to content

Commit

Permalink
MERGE-FIX: Update src/primitives/bitcoin/
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed May 20, 2019
1 parent f4889a5 commit 39c2906
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/primitives/bitcoin/merkleblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::ve
else
right = left;
// combine subhashes
return Hash(BEGIN(left), END(left), BEGIN(right), END(right));
return Hash(left.begin(), left.end(), right.begin(), right.end());
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, uns
right = left;
}
// 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());
}
}

Expand Down
14 changes: 8 additions & 6 deletions src/primitives/bitcoin/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class COutPoint
uint256 hash;
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) { }

ADD_SERIALIZE_METHODS;
Expand All @@ -35,8 +37,8 @@ class COutPoint
READWRITE(n);
}

void SetNull() { hash.SetNull(); n = (uint32_t) -1; }
bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); }
void SetNull() { hash.SetNull(); n = NULL_INDEX; }
bool IsNull() const { return (hash.IsNull() && n == NULL_INDEX); }

friend bool operator<(const COutPoint& a, const COutPoint& b)
{
Expand Down Expand Up @@ -67,7 +69,7 @@ class CTxIn
COutPoint prevout;
CScript scriptSig;
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
* disables nLockTime. */
Expand All @@ -76,7 +78,7 @@ class CTxIn
/* Below flags apply in the context of BIP 68*/
/* If this flag set, CTxIn::nSequence is NOT interpreted as a
* 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
* is set, the relative lock-time has units of 512 seconds,
Expand Down Expand Up @@ -299,7 +301,7 @@ class CTransaction
CTransaction();

/** Convert a CMutableTransaction into a CTransaction. */
CTransaction(const CMutableTransaction &tx);
explicit CTransaction(const CMutableTransaction &tx);
CTransaction(CMutableTransaction &&tx);

template <typename Stream>
Expand Down

0 comments on commit 39c2906

Please sign in to comment.