diff options
author | John Newbery <john@johnnewbery.com> | 2017-02-09 18:59:32 -0500 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2017-02-10 13:13:48 -0500 |
commit | 99c0e81b9529dbcbc262bdc9854cbb0517c5a8fd (patch) | |
tree | dcd29c307a288ba49ecee5c1da0206bdf0874f07 /qa/rpc-tests | |
parent | b860915f8b0dae98e57a254d11575ea41f5c5a79 (diff) | |
download | bitcoin-99c0e81b9529dbcbc262bdc9854cbb0517c5a8fd.tar.xz |
Fix BIP68 activation test
Diffstat (limited to 'qa/rpc-tests')
-rwxr-xr-x | qa/rpc-tests/bip68-sequence.py | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/qa/rpc-tests/bip68-sequence.py b/qa/rpc-tests/bip68-sequence.py index a12bf10ebd..ae3a3147a4 100755 --- a/qa/rpc-tests/bip68-sequence.py +++ b/qa/rpc-tests/bip68-sequence.py @@ -51,15 +51,12 @@ class BIP68Test(BitcoinTestFramework): print("Running test BIP68 not consensus before versionbits activation") self.test_bip68_not_consensus() - print("Verifying nVersion=2 transactions aren't standard") - self.test_version2_relay(before_activation=True) + print("Verifying nVersion=2 transactions are standard") + self.test_version2_relay() print("Activating BIP68 (and 112/113)") self.activateCSV() - print("Verifying nVersion=2 transactions are now standard") - self.test_version2_relay(before_activation=False) - print("Passed\n") # Test that BIP68 is not in effect if tx version is 1, or if @@ -399,17 +396,8 @@ class BIP68Test(BitcoinTestFramework): self.nodes[0].submitblock(ToHex(block)) assert_equal(self.nodes[0].getbestblockhash(), block.hash) - def activateCSV(self): - # activation should happen at block height 432 (3 periods) - min_activation_height = 432 - height = self.nodes[0].getblockcount() - assert(height < 432) - self.nodes[0].generate(432-height) - assert(get_bip9_status(self.nodes[0], 'csv')['status'] == 'active') - sync_blocks(self.nodes) - - # Use self.nodes[1] to test standardness relay policy - def test_version2_relay(self, before_activation): + # Use self.nodes[1] to test that version 2 transactions are standard even before BIP68 activation. + def test_version2_relay(self): inputs = [ ] outputs = { self.nodes[1].getnewaddress() : 1.0 } rawtx = self.nodes[1].createrawtransaction(inputs, outputs) @@ -417,12 +405,16 @@ class BIP68Test(BitcoinTestFramework): tx = FromHex(CTransaction(), rawtxfund) tx.nVersion = 2 tx_signed = self.nodes[1].signrawtransaction(ToHex(tx))["hex"] - try: - tx_id = self.nodes[1].sendrawtransaction(tx_signed) - assert(before_activation == False) - except: - assert(before_activation) + tx_id = self.nodes[1].sendrawtransaction(tx_signed) + def activateCSV(self): + # activation should happen at block height 432 (3 periods) + min_activation_height = 432 + height = self.nodes[0].getblockcount() + assert(height < 432) + self.nodes[0].generate(432-height) + assert(get_bip9_status(self.nodes[0], 'csv')['status'] == 'active') + sync_blocks(self.nodes) if __name__ == '__main__': BIP68Test().main() |