|
57 | 57 | softfork_active,
|
58 | 58 | )
|
59 | 59 |
|
| 60 | +TESTING_TX_COUNT = 83 # Number of testing transactions: 1 BIP113 tx, 16 BIP68 txs, 66 BIP112 txs (see comments above) |
| 61 | +COINBASE_BLOCK_COUNT = TESTING_TX_COUNT # Number of coinbase blocks we need to generate as inputs for our txs |
60 | 62 | BASE_RELATIVE_LOCKTIME = 10
|
61 | 63 | CSV_ACTIVATION_HEIGHT = 432
|
62 | 64 | SEQ_DISABLE_FLAG = 1 << 31
|
@@ -188,15 +190,16 @@ def run_test(self):
|
188 | 190 | self.log.info("Generate blocks in the past for coinbase outputs.")
|
189 | 191 | long_past_time = int(time.time()) - 600 * 1000 # enough to build up to 1000 blocks 10 minutes apart without worrying about getting into the future
|
190 | 192 | self.nodes[0].setmocktime(long_past_time - 100) # enough so that the generated blocks will still all be before long_past_time
|
191 |
| - self.coinbase_blocks = self.nodes[0].generate(1 + 16 + 2 * 32 + 2) # 83 blocks generated for inputs |
| 193 | + self.coinbase_blocks = self.nodes[0].generate(COINBASE_BLOCK_COUNT) # blocks generated for inputs |
192 | 194 | self.nodes[0].setmocktime(0) # set time back to present so yielded blocks aren't in the future as we advance last_block_time
|
193 |
| - self.tipheight = 83 # height of the next block to build |
| 195 | + self.tipheight = COINBASE_BLOCK_COUNT # height of the next block to build |
194 | 196 | self.last_block_time = long_past_time
|
195 | 197 | self.tip = int(self.nodes[0].getbestblockhash(), 16)
|
196 | 198 | self.nodeaddress = self.nodes[0].getnewaddress()
|
197 | 199 |
|
198 | 200 | # Activation height is hardcoded
|
199 |
| - test_blocks = self.generate_blocks(344) |
| 201 | + # We advance to block height five below BIP112 activation for the following tests |
| 202 | + test_blocks = self.generate_blocks(CSV_ACTIVATION_HEIGHT-5 - COINBASE_BLOCK_COUNT) |
200 | 203 | self.send_blocks(test_blocks)
|
201 | 204 | assert not softfork_active(self.nodes[0], 'csv')
|
202 | 205 |
|
@@ -239,7 +242,7 @@ def run_test(self):
|
239 | 242 | self.tip = int(inputblockhash, 16)
|
240 | 243 | self.tipheight += 1
|
241 | 244 | self.last_block_time += 600
|
242 |
| - assert_equal(len(self.nodes[0].getblock(inputblockhash, True)["tx"]), 83 + 1) |
| 245 | + assert_equal(len(self.nodes[0].getblock(inputblockhash, True)["tx"]), TESTING_TX_COUNT + 1) |
243 | 246 |
|
244 | 247 | # 2 more version 4 blocks
|
245 | 248 | test_blocks = self.generate_blocks(2)
|
|
0 commit comments