@@ -70,25 +70,45 @@ class CTxIn
70
70
uint32_t nSequence;
71
71
CScriptWitness scriptWitness; // !< Only serialized through CTransaction
72
72
73
- /* Setting nSequence to this value for every input in a transaction
74
- * disables nLockTime. */
73
+ /* *
74
+ * Setting nSequence to this value for every input in a transaction
75
+ * disables nLockTime/IsFinalTx().
76
+ * It fails OP_CHECKLOCKTIMEVERIFY/CheckLockTime() for any input that has
77
+ * it set (BIP 65).
78
+ * It has SEQUENCE_LOCKTIME_DISABLE_FLAG set (BIP 68/112).
79
+ */
75
80
static const uint32_t SEQUENCE_FINAL = 0xffffffff ;
81
+ /* *
82
+ * This is the maximum sequence number that enables both nLockTime and
83
+ * OP_CHECKLOCKTIMEVERIFY (BIP 65).
84
+ * It has SEQUENCE_LOCKTIME_DISABLE_FLAG set (BIP 68/112).
85
+ */
86
+ static const uint32_t MAX_SEQUENCE_NONFINAL{SEQUENCE_FINAL - 1 };
76
87
77
- /* Below flags apply in the context of BIP 68*/
78
- /* If this flag set, CTxIn::nSequence is NOT interpreted as a
79
- * relative lock-time. */
88
+ // Below flags apply in the context of BIP 68. BIP 68 requires the tx
89
+ // version to be set to 2, or higher.
90
+ /* *
91
+ * If this flag is set, CTxIn::nSequence is NOT interpreted as a
92
+ * relative lock-time.
93
+ * It skips SequenceLocks() for any input that has it set (BIP 68).
94
+ * It fails OP_CHECKSEQUENCEVERIFY/CheckSequence() for any input that has
95
+ * it set (BIP 112).
96
+ */
80
97
static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = (1U << 31 );
81
98
82
- /* If CTxIn::nSequence encodes a relative lock-time and this flag
99
+ /* *
100
+ * If CTxIn::nSequence encodes a relative lock-time and this flag
83
101
* is set, the relative lock-time has units of 512 seconds,
84
102
* otherwise it specifies blocks with a granularity of 1. */
85
103
static const uint32_t SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22 );
86
104
87
- /* If CTxIn::nSequence encodes a relative lock-time, this mask is
105
+ /* *
106
+ * If CTxIn::nSequence encodes a relative lock-time, this mask is
88
107
* applied to extract that lock-time from the sequence field. */
89
108
static const uint32_t SEQUENCE_LOCKTIME_MASK = 0x0000ffff ;
90
109
91
- /* In order to use the same number of bits to encode roughly the
110
+ /* *
111
+ * In order to use the same number of bits to encode roughly the
92
112
* same wall-clock duration, and because blocks are naturally
93
113
* limited to occur every 600s on average, the minimum granularity
94
114
* for time-based relative lock-time is fixed at 512 seconds.
0 commit comments