| 16 | #include <util/moneystr.h> |
| 17 | |
| 18 | bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) |
| 19 | { |
| 20 | if (tx.nLockTime == 0) |
| 21 | return true; |
| 22 | if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) |
| 23 | return true; |
| 24 | |
| 25 | // Even if tx.nLockTime isn't satisfied by nBlockHeight/nBlockTime, a |
| 26 | // transaction is still considered final if all inputs' nSequence == |
| 27 | // SEQUENCE_FINAL (0xffffffff), in which case nLockTime is ignored. |
| 28 | // |
| 29 | // Because of this behavior OP_CHECKLOCKTIMEVERIFY/CheckLockTime() will |
| 30 | // also check that the spending input's nSequence != SEQUENCE_FINAL, |
| 31 | // ensuring that an unsatisfied nLockTime value will actually cause |
| 32 | // IsFinalTx() to return false here: |
| 33 | for (const auto& txin : tx.vin) { |
| 34 | if (!(txin.nSequence == CTxIn::SEQUENCE_FINAL)) |
| 35 | return false; |
| 36 | } |
| 37 | return true; |
| 38 | } |
| 39 | |
| 40 | std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector<int>& prevHeights, const CBlockIndex& block) |
| 41 | { |
no outgoing calls