main.h: CTransaction::IsFinal() decides, when a transaction is considered final.
Now, it looks like nLockTime is not really used currently, so if is the line
if (nLockTime == 0) return true;which usually is doing its job here.
A bit lower in the code there is this little thingie:
if ((int64)nLockTime < (nLockTime < 500000000 ? (int64)nBlockHeight : nBlockTime)) return true;which I personally would have expected to be
if ((int64)nLockTime < nBlockTime) return true;What is the purpose of comparing to BlockHeight in case nLockTime is smaller than 500 000 000. 500 000 000 is definitely in the past?
As nLockTime is compared to GetAdjustedTime() earlier in the code, it is absolute Unix epoch time. 500 000 000 is November 05, 1985, 01:53:20 in my timezone. What's the idea of comparing with this date in the past ?!? Moreover: if
nLockTime < 500000000 then almost certainly also
nLockTime < nBlockHeight so this earlier test does not make sense ?!?
I would appreciate any ideas shedding some light on this line of code.
And, while being in this part of the code, a bit lower in IsFinal() we find:
BOOST_FOREACH(const CTxIn& txin, vin) if (!txin.IsFinal()) return false;The logic is obvious: If an input to a transaction is not final, then the transaction under consideration is not final. But...hm...shouldn't this be the very first thing to check? There are various cases earlier in the function which lets the system decide that a transaction is final - without having made this check.