mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-19 13:27:35 +02:00
Get rid of CTxIn::IsFinal(), which is only used in one location and whose semantics will not survive revival of sequence numbers
This commit is contained in:
parent
553ff39655
commit
2be1de38aa
4 changed files with 7 additions and 12 deletions
|
|
@ -733,7 +733,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
|
|||
|
||||
bool fFinalized = true;
|
||||
BOOST_FOREACH(const CTxIn& txin, tx.vin)
|
||||
fFinalized = fFinalized && txin.IsFinal();
|
||||
fFinalized = fFinalized && !~txin.nSequence;
|
||||
|
||||
if (!fFinalized && (int64_t)tx.nLockTime >= ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ std::string CTxIn::ToString() const
|
|||
str += strprintf(", coinbase %s", HexStr(scriptSig));
|
||||
else
|
||||
str += strprintf(", scriptSig=%s", scriptSig.ToString().substr(0,24));
|
||||
if (nSequence != std::numeric_limits<unsigned int>::max())
|
||||
if (~nSequence)
|
||||
str += strprintf(", nSequence=%u", nSequence);
|
||||
str += ")";
|
||||
return str;
|
||||
|
|
|
|||
|
|
@ -62,11 +62,11 @@ public:
|
|||
|
||||
CTxIn()
|
||||
{
|
||||
nSequence = std::numeric_limits<unsigned int>::max();
|
||||
nSequence = ~(uint32_t)0;
|
||||
}
|
||||
|
||||
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<unsigned int>::max());
|
||||
CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=std::numeric_limits<uint32_t>::max());
|
||||
explicit CTxIn(COutPoint prevoutIn, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=~(uint32_t)0);
|
||||
CTxIn(uint256 hashPrevTx, uint32_t nOut, CScript scriptSigIn=CScript(), uint32_t nSequenceIn=~(uint32_t)0);
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
|
|
@ -77,11 +77,6 @@ public:
|
|||
READWRITE(nSequence);
|
||||
}
|
||||
|
||||
bool IsFinal() const
|
||||
{
|
||||
return (nSequence == std::numeric_limits<uint32_t>::max());
|
||||
}
|
||||
|
||||
friend bool operator==(const CTxIn& a, const CTxIn& b)
|
||||
{
|
||||
return (a.prevout == b.prevout &&
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey)
|
|||
txCredit.vout.resize(1);
|
||||
txCredit.vin[0].prevout.SetNull();
|
||||
txCredit.vin[0].scriptSig = CScript() << CScriptNum(0) << CScriptNum(0);
|
||||
txCredit.vin[0].nSequence = std::numeric_limits<unsigned int>::max();
|
||||
txCredit.vin[0].nSequence = ~(uint32_t)0;
|
||||
txCredit.vout[0].scriptPubKey = scriptPubKey;
|
||||
txCredit.vout[0].nValue = 0;
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CMu
|
|||
txSpend.vin[0].prevout.hash = txCredit.GetHash();
|
||||
txSpend.vin[0].prevout.n = 0;
|
||||
txSpend.vin[0].scriptSig = scriptSig;
|
||||
txSpend.vin[0].nSequence = std::numeric_limits<unsigned int>::max();
|
||||
txSpend.vin[0].nSequence = ~(uint32_t)0;
|
||||
txSpend.vout[0].scriptPubKey = CScript();
|
||||
txSpend.vout[0].nValue = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue