Skip to content

Commit 99c0e81

Browse files
committed
Fix BIP68 activation test
1 parent b860915 commit 99c0e81

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

qa/rpc-tests/bip68-sequence.py

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,12 @@ def run_test(self):
5151
print("Running test BIP68 not consensus before versionbits activation")
5252
self.test_bip68_not_consensus()
5353

54-
print("Verifying nVersion=2 transactions aren't standard")
55-
self.test_version2_relay(before_activation=True)
54+
print("Verifying nVersion=2 transactions are standard")
55+
self.test_version2_relay()
5656

5757
print("Activating BIP68 (and 112/113)")
5858
self.activateCSV()
5959

60-
print("Verifying nVersion=2 transactions are now standard")
61-
self.test_version2_relay(before_activation=False)
62-
6360
print("Passed\n")
6461

6562
# Test that BIP68 is not in effect if tx version is 1, or if
@@ -399,30 +396,25 @@ def test_bip68_not_consensus(self):
399396
self.nodes[0].submitblock(ToHex(block))
400397
assert_equal(self.nodes[0].getbestblockhash(), block.hash)
401398

402-
def activateCSV(self):
403-
# activation should happen at block height 432 (3 periods)
404-
min_activation_height = 432
405-
height = self.nodes[0].getblockcount()
406-
assert(height < 432)
407-
self.nodes[0].generate(432-height)
408-
assert(get_bip9_status(self.nodes[0], 'csv')['status'] == 'active')
409-
sync_blocks(self.nodes)
410-
411-
# Use self.nodes[1] to test standardness relay policy
412-
def test_version2_relay(self, before_activation):
399+
# Use self.nodes[1] to test that version 2 transactions are standard even before BIP68 activation.
400+
def test_version2_relay(self):
413401
inputs = [ ]
414402
outputs = { self.nodes[1].getnewaddress() : 1.0 }
415403
rawtx = self.nodes[1].createrawtransaction(inputs, outputs)
416404
rawtxfund = self.nodes[1].fundrawtransaction(rawtx)['hex']
417405
tx = FromHex(CTransaction(), rawtxfund)
418406
tx.nVersion = 2
419407
tx_signed = self.nodes[1].signrawtransaction(ToHex(tx))["hex"]
420-
try:
421-
tx_id = self.nodes[1].sendrawtransaction(tx_signed)
422-
assert(before_activation == False)
423-
except:
424-
assert(before_activation)
408+
tx_id = self.nodes[1].sendrawtransaction(tx_signed)
425409

410+
def activateCSV(self):
411+
# activation should happen at block height 432 (3 periods)
412+
min_activation_height = 432
413+
height = self.nodes[0].getblockcount()
414+
assert(height < 432)
415+
self.nodes[0].generate(432-height)
416+
assert(get_bip9_status(self.nodes[0], 'csv')['status'] == 'active')
417+
sync_blocks(self.nodes)
426418

427419
if __name__ == '__main__':
428420
BIP68Test().main()

0 commit comments

Comments
 (0)