@@ -64,21 +64,21 @@ enum {
64
64
/* Setting nSequence to this value for every input in a transaction
65
65
* disables nLockTime. */
66
66
static const uint32_t SEQUENCE_FINAL = 0xffffffff;
67
-
67
+
68
+ /* Below flags apply in the context of BIP 68*/
68
69
/* If this flag set, CTxIn::nSequence is NOT interpreted as a
69
- * relative lock-time. Setting the most significant bit of a
70
- * sequence number disabled relative lock-time. */
70
+ * relative lock-time. */
71
71
static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31);
72
-
72
+
73
73
/* If CTxIn::nSequence encodes a relative lock-time and this flag
74
74
* is set, the relative lock-time has units of 512 seconds,
75
75
* otherwise it specifies blocks with a granularity of 1. */
76
76
static const uint32_t SEQUENCE_LOCKTIME_TYPE_FLAG = (1 << 22);
77
-
77
+
78
78
/* If CTxIn::nSequence encodes a relative lock-time, this mask is
79
79
* applied to extract that lock-time from the sequence field. */
80
80
static const uint32_t SEQUENCE_LOCKTIME_MASK = 0x0000ffff;
81
-
81
+
82
82
/* In order to use the same number of bits to encode roughly the
83
83
* same wall-clock duration, and because blocks are naturally
84
84
* limited to occur every 600s on average, the minimum granularity
@@ -87,7 +87,7 @@ static const uint32_t SEQUENCE_LOCKTIME_MASK = 0x0000ffff;
87
87
* multiplying by 512 = 2^9, or equivalently shifting up by
88
88
* 9 bits. */
89
89
static const int SEQUENCE_LOCKTIME_GRANULARITY = 9;
90
-
90
+
91
91
/**
92
92
* Calculates the block height and previous block's median time past at
93
93
* which the transaction will be considered final in the context of BIP 68.
@@ -174,16 +174,17 @@ bool SequenceLocks(const CTransaction &tx, int flags, std::vector<int>* prevHeig
174
174
bool CheckSequenceLocks(const CTransaction &tx, int flags)
175
175
{
176
176
AssertLockHeld(cs_main);
177
+ AssertLockHeld(mempool.cs);
177
178
178
179
CBlockIndex* tip = chainActive.Tip();
179
180
CBlockIndex index;
180
181
index.pprev = tip;
181
182
// CheckSequenceLocks() uses chainActive.Height()+1 to evaluate
182
183
// height based locks because when SequenceLocks() is called within
183
- // CBlock::AcceptBlock (), the height of the block *being*
184
- // evaluated is what is used. Thus if we want to know if a
185
- // transaction can be part of the *next* block, we need to call
186
- // SequenceLocks() with one more than chainActive.Height().
184
+ // ConnectBlock (), the height of the block *being*
185
+ // evaluated is what is used.
186
+ // Thus if we want to know if a transaction can be part of the
187
+ // *next* block, we need to use one more than chainActive.Height()
187
188
index.nHeight = tip->nHeight + 1;
188
189
189
190
// pcoinsTip contains the UTXO set for chainActive.Tip()
0 commit comments