mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 19:23:41 +02:00
Use Txid in COutpoint
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user