Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add -testactivationheight tests to rpc_blockchain #23086

Merged
merged 1 commit into from Sep 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 28 additions & 6 deletions test/functional/rpc_blockchain.py
Expand Up @@ -127,7 +127,29 @@ def _test_getblockchaininfo(self):
# should have exact keys
assert_equal(sorted(res.keys()), keys)

self.restart_node(0, ['-stopatheight=207', '-prune=550'])
self.stop_node(0)
self.nodes[0].assert_start_raises_init_error(
extra_args=['-testactivationheight=name@2'],
expected_msg='Error: Invalid name (name@2) for -testactivationheight=name@height.',
)
self.nodes[0].assert_start_raises_init_error(
extra_args=['-testactivationheight=bip34@-2'],
expected_msg='Error: Invalid height value (bip34@-2) for -testactivationheight=name@height.',
)
self.nodes[0].assert_start_raises_init_error(
extra_args=['-testactivationheight='],
expected_msg='Error: Invalid format () for -testactivationheight=name@height.',
)
self.start_node(0, extra_args=[
'-stopatheight=207',
'-prune=550',
'-testactivationheight=bip34@2',
'-testactivationheight=dersig@3',
'-testactivationheight=cltv@4',
'-testactivationheight=csv@5',
'-testactivationheight=segwit@6',
])

res = self.nodes[0].getblockchaininfo()
# result should have these additional pruning keys if prune=550
assert_equal(sorted(res.keys()), sorted(['pruneheight', 'automatic_pruning', 'prune_target_size'] + keys))
Expand All @@ -140,11 +162,11 @@ def _test_getblockchaininfo(self):
assert_greater_than(res['size_on_disk'], 0)

assert_equal(res['softforks'], {
'bip34': {'type': 'buried', 'active': True, 'height': 1},
'bip66': {'type': 'buried', 'active': True, 'height': 1},
'bip65': {'type': 'buried', 'active': True, 'height': 1},
'csv': {'type': 'buried', 'active': True, 'height': 1},
'segwit': {'type': 'buried', 'active': True, 'height': 1},
'bip34': {'type': 'buried', 'active': True, 'height': 2},
'bip66': {'type': 'buried', 'active': True, 'height': 3},
'bip65': {'type': 'buried', 'active': True, 'height': 4},
'csv': {'type': 'buried', 'active': True, 'height': 5},
'segwit': {'type': 'buried', 'active': True, 'height': 6},
'testdummy': {
'type': 'bip9',
'bip9': {
Expand Down