aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_cltv.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-07-02 14:23:04 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-07-02 15:25:13 -0400
commitfaf6caf4daa33b9179f4f02c09e184245ea53fa1 (patch)
treef4b5ec5b7ee3d150a06f39170151c7205858a9ec /test/functional/feature_cltv.py
parent2f717fb5cdfc312784f9c1539fc41cdfcfbde452 (diff)
downloadbitcoin-faf6caf4daa33b9179f4f02c09e184245ea53fa1.tar.xz
test: Add tests for getblockchaininfo.softforks
Diffstat (limited to 'test/functional/feature_cltv.py')
-rwxr-xr-xtest/functional/feature_cltv.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py
index b16eafccca..7712e8bdf6 100755
--- a/test/functional/feature_cltv.py
+++ b/test/functional/feature_cltv.py
@@ -64,9 +64,23 @@ class BIP65Test(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
+ def test_cltv_info(self, *, is_active):
+ assert_equal(
+ next(s for s in self.nodes[0].getblockchaininfo()['softforks'] if s['id'] == 'bip65'),
+ {
+ "id": "bip65",
+ "version": 4,
+ "reject": {
+ "status": is_active
+ }
+ },
+ )
+
def run_test(self):
self.nodes[0].add_p2p_connection(P2PInterface())
+ self.test_cltv_info(is_active=False)
+
self.log.info("Mining %d blocks", CLTV_HEIGHT - 2)
self.coinbase_txids = [self.nodes[0].getblock(b)['tx'][0] for b in self.nodes[0].generate(CLTV_HEIGHT - 2)]
self.nodeaddress = self.nodes[0].getnewaddress()
@@ -86,7 +100,9 @@ class BIP65Test(BitcoinTestFramework):
block.hashMerkleRoot = block.calc_merkle_root()
block.solve()
+ self.test_cltv_info(is_active=False)
self.nodes[0].p2p.send_and_ping(msg_block(block))
+ self.test_cltv_info(is_active=False) # Not active as of current tip, but next block must obey rules
assert_equal(self.nodes[0].getbestblockhash(), block.hash)
self.log.info("Test that blocks must now be at least version 4")
@@ -135,7 +151,9 @@ class BIP65Test(BitcoinTestFramework):
block.hashMerkleRoot = block.calc_merkle_root()
block.solve()
+ self.test_cltv_info(is_active=False) # Not active as of current tip, but next block must obey rules
self.nodes[0].p2p.send_and_ping(msg_block(block))
+ self.test_cltv_info(is_active=True) # Active as of current tip
assert_equal(int(self.nodes[0].getbestblockhash(), 16), block.sha256)