bitcoind IsFinalTx()
as seen here checks the properties of a transaction in this order:
- Is
nLockTime
exactly0
? That's final. return. - If it's not
0
, is it below the current block height / time? If so, it's final. return. - Ensure that every tx input is exactly
0xffffffff
. If so, it's final.
Because these are checked in order with return
statements, nSequence
won't even be checked if nLockTime == 0
. Furthermore, a transaction that is NOT past its nLockTime
value could still be "final" as long as all the nSequence
values are 0xffffffff
Non-final transactions are not valid in blocks, so my questions are:
Why is a "bad" locktime ok as long as all sequences are final? The tx won't be mineable anyway, right?
What are the implications for replace-by-fee and Check Sequence Verify transactions (when a non-final
nSequence
value is used)? Does this mean that to use those features,nLockTime
has to be set a certain way?Or, maybe, because
nLockTime
has to be below the current time/height anyway, this is all just moot and really,nSequence
doesn't really impact transaction finality at all.