aboutsummaryrefslogtreecommitdiff
path: root/test/functional/bip65-cltv.py
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2017-06-28 14:52:24 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2017-06-30 09:04:36 -0400
commitd4f0d87b6fe800b6500dc5baff2e8db33e151da5 (patch)
treefd07108816d4823e36b0c909b824be70eec664ca /test/functional/bip65-cltv.py
parentd4e551adfec298d12f2147467227f07e3a94b872 (diff)
downloadbitcoin-d4f0d87b6fe800b6500dc5baff2e8db33e151da5.tar.xz
[qa] Rewrite BIP65 functional tests
After 122786d0e0170c73536360b705af711e1338adbf, BIP65 activates at a particular height (without regard to version numbers of blocks below that height). Rewrite the BIP65 functional tests to take this into account, and add a test case that exercises OP_CHECKLOCKTIMEVERIFY in a block where the soft-fork is active. Also moves the bip65 functional test out of the extended test suite.
Diffstat (limited to 'test/functional/bip65-cltv.py')
-rwxr-xr-xtest/functional/bip65-cltv.py82
1 files changed, 0 insertions, 82 deletions
diff --git a/test/functional/bip65-cltv.py b/test/functional/bip65-cltv.py
deleted file mode 100755
index ddf932c746..0000000000
--- a/test/functional/bip65-cltv.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env python3
-# Copyright (c) 2015-2016 The Bitcoin Core developers
-# Distributed under the MIT software license, see the accompanying
-# file COPYING or http://www.opensource.org/licenses/mit-license.php.
-"""Test the CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic."""
-
-from test_framework.test_framework import BitcoinTestFramework
-from test_framework.util import *
-
-class BIP65Test(BitcoinTestFramework):
- def __init__(self):
- super().__init__()
- self.num_nodes = 3
- self.setup_clean_chain = False
- self.extra_args = [[], ["-blockversion=3"], ["-blockversion=4"]]
-
- def setup_network(self):
- self.setup_nodes()
- connect_nodes(self.nodes[1], 0)
- connect_nodes(self.nodes[2], 0)
- self.sync_all()
-
- def run_test(self):
- cnt = self.nodes[0].getblockcount()
-
- # Mine some old-version blocks
- self.nodes[1].generate(200)
- cnt += 100
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 100):
- raise AssertionError("Failed to mine 100 version=3 blocks")
-
- # Mine 750 new-version blocks
- for i in range(15):
- self.nodes[2].generate(50)
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 850):
- raise AssertionError("Failed to mine 750 version=4 blocks")
-
- # TODO: check that new CHECKLOCKTIMEVERIFY rules are not enforced
-
- # Mine 1 new-version block
- self.nodes[2].generate(1)
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 851):
- raise AssertionError("Failed to mine a version=4 blocks")
-
- # TODO: check that new CHECKLOCKTIMEVERIFY rules are enforced
-
- # Mine 198 new-version blocks
- for i in range(2):
- self.nodes[2].generate(99)
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 1049):
- raise AssertionError("Failed to mine 198 version=4 blocks")
-
- # Mine 1 old-version block
- self.nodes[1].generate(1)
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 1050):
- raise AssertionError("Failed to mine a version=3 block after 949 version=4 blocks")
-
- # Mine 1 new-version blocks
- self.nodes[2].generate(1)
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 1051):
- raise AssertionError("Failed to mine a version=4 block")
-
- # Mine 1 old-version blocks. This should fail
- assert_raises_jsonrpc(-1,"CreateNewBlock: TestBlockValidity failed: bad-version(0x00000003)", self.nodes[1].generate, 1)
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 1051):
- raise AssertionError("Accepted a version=3 block after 950 version=4 blocks")
-
- # Mine 1 new-version blocks
- self.nodes[2].generate(1)
- self.sync_all()
- if (self.nodes[0].getblockcount() != cnt + 1052):
- raise AssertionError("Failed to mine a version=4 block")
-
-if __name__ == '__main__':
- BIP65Test().main()