diff options
author | dergoegge <n.goeggi@gmail.com> | 2023-10-11 14:53:04 +0100 |
---|---|---|
committer | dergoegge <n.goeggi@gmail.com> | 2023-11-21 13:15:44 +0000 |
commit | 9e58c5bcd96e7ff2062274868814ccae0626589e (patch) | |
tree | b5aa7606931ec3cac2a5e3ce40421562c8fa48f8 /src/primitives | |
parent | d752349029ec7a76f1fd440db2ec2e458d0f3c99 (diff) | |
download | bitcoin-9e58c5bcd96e7ff2062274868814ccae0626589e.tar.xz |
Use Txid in COutpoint
Diffstat (limited to 'src/primitives')
-rw-r--r-- | src/primitives/transaction.cpp | 2 | ||||
-rw-r--r-- | src/primitives/transaction.h | 9 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index 82fb59d349..002c922c0d 100644 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -29,7 +29,7 @@ CTxIn::CTxIn(COutPoint prevoutIn, CScript scriptSigIn, uint32_t nSequenceIn) nSequence = nSequenceIn; } -CTxIn::CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn, uint32_t nSequenceIn) +CTxIn::CTxIn(Txid hashPrevTx, uint32_t nOut, CScript scriptSigIn, uint32_t nSequenceIn) { prevout = COutPoint(hashPrevTx, nOut); scriptSig = scriptSigIn; diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index ad190f7d7f..e0c0c860c6 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -28,13 +28,13 @@ class COutPoint { public: - uint256 hash; + Txid hash; uint32_t n; 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 Txid& hashIn, uint32_t nIn): hash(hashIn), n(nIn) { } SERIALIZE_METHODS(COutPoint, obj) { READWRITE(obj.hash, obj.n); } @@ -43,8 +43,7 @@ public: 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); + return std::tie(a.hash, a.n) < std::tie(b.hash, b.n); } friend bool operator==(const COutPoint& a, const COutPoint& b) @@ -125,7 +124,7 @@ public: } explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=SEQUENCE_FINAL); - CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=SEQUENCE_FINAL); + CTxIn(Txid hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=SEQUENCE_FINAL); SERIALIZE_METHODS(CTxIn, obj) { READWRITE(obj.prevout, obj.scriptSig, obj.nSequence); } |