diff --git a/src/core.cpp b/src/core.cpp index 71d6fea61..e6636ae04 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -12,14 +12,14 @@ std::string COutPoint::ToString() const return strprintf("COutPoint(%s, %u)", hash.ToString().substr(0,10), n); } -CTxIn::CTxIn(COutPoint prevoutIn, CScript scriptSigIn, unsigned int nSequenceIn) +CTxIn::CTxIn(COutPoint prevoutIn, CScript scriptSigIn, uint32_t nSequenceIn) { prevout = prevoutIn; scriptSig = scriptSigIn; nSequence = nSequenceIn; } -CTxIn::CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn, unsigned int nSequenceIn) +CTxIn::CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn, uint32_t nSequenceIn) { prevout = COutPoint(hashPrevTx, nOut); scriptSig = scriptSigIn; diff --git a/src/core.h b/src/core.h index e3ceac97a..126e1baa9 100644 --- a/src/core.h +++ b/src/core.h @@ -26,13 +26,13 @@ class COutPoint { public: uint256 hash; - unsigned int n; + 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 = (unsigned int) -1; } - bool IsNull() const { return (hash == 0 && n == (unsigned int) -1); } + void SetNull() { hash = 0; n = (uint32_t) -1; } + bool IsNull() const { return (hash == 0 && n == (uint32_t) -1); } friend bool operator<(const COutPoint& a, const COutPoint& b) { @@ -57,12 +57,12 @@ class CInPoint { public: const CTransaction* ptx; - unsigned int n; + uint32_t n; CInPoint() { SetNull(); } - CInPoint(const CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; } - void SetNull() { ptx = NULL; n = (unsigned int) -1; } - bool IsNull() const { return (ptx == NULL && n == (unsigned int) -1); } + CInPoint(const CTransaction* ptxIn, uint32_t nIn) { ptx = ptxIn; n = nIn; } + void SetNull() { ptx = NULL; n = (uint32_t) -1; } + bool IsNull() const { return (ptx == NULL && n == (uint32_t) -1); } }; /** An input of a transaction. It contains the location of the previous @@ -74,15 +74,15 @@ class CTxIn public: COutPoint prevout; CScript scriptSig; - unsigned int nSequence; + uint32_t nSequence; CTxIn() { nSequence = std::numeric_limits::max(); } - explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=std::numeric_limits::max()); - CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn=CScript(), unsigned int nSequenceIn=std::numeric_limits::max()); + explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits::max()); + CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits::max()); IMPLEMENT_SERIALIZE ( @@ -93,7 +93,7 @@ public: bool IsFinal() const { - return (nSequence == std::numeric_limits::max()); + return (nSequence == std::numeric_limits::max()); } friend bool operator==(const CTxIn& a, const CTxIn& b) @@ -217,17 +217,17 @@ private: void UpdateHash() const; public: - static const int CURRENT_VERSION=1; + static const int32_t CURRENT_VERSION=1; // The local variables are made const to prevent unintended modification // without updating the cached hash value. However, CTransaction is not // actually immutable; deserialization and assignment are implemented, // and bypass the constness. This is safe, as they update the entire // structure, including the hash. - const int nVersion; + const int32_t nVersion; const std::vector vin; const std::vector vout; - const unsigned int nLockTime; + const uint32_t nLockTime; /** Construct a CTransaction that qualifies as IsNull() */ CTransaction(); @@ -238,11 +238,11 @@ public: CTransaction& operator=(const CTransaction& tx); IMPLEMENT_SERIALIZE( - READWRITE(*const_cast(&this->nVersion)); + READWRITE(*const_cast(&this->nVersion)); nVersion = this->nVersion; READWRITE(*const_cast*>(&vin)); READWRITE(*const_cast*>(&vout)); - READWRITE(*const_cast(&nLockTime)); + READWRITE(*const_cast(&nLockTime)); if (fRead) UpdateHash(); ) @@ -284,10 +284,10 @@ public: /** A mutable version of CTransaction. */ struct CMutableTransaction { - int nVersion; + int32_t nVersion; std::vector vin; std::vector vout; - unsigned int nLockTime; + uint32_t nLockTime; CMutableTransaction(); CMutableTransaction(const CTransaction& tx); @@ -399,13 +399,13 @@ class CBlockHeader { public: // header - static const int CURRENT_VERSION=2; - int nVersion; + static const int32_t CURRENT_VERSION=2; + int32_t nVersion; uint256 hashPrevBlock; uint256 hashMerkleRoot; - unsigned int nTime; - unsigned int nBits; - unsigned int nNonce; + uint32_t nTime; + uint32_t nBits; + uint32_t nNonce; CBlockHeader() {