qa: Remove hard-coded consensus branch IDs from RPC tests
Also fixes a bug in the `nuparams` helper, which would have caused MSB zeroes in consensus branch IDs to not be rendered in the `-nuparams` option. This hadn't been encountered because we haven't yet generated a consensus branch ID with a zero MSB.
This commit is contained in:
parent
e5210d50c9
commit
165901c654
|
@ -12,6 +12,7 @@ from test_framework.util import (
|
||||||
NU5_BRANCH_ID,
|
NU5_BRANCH_ID,
|
||||||
hex_str_to_bytes,
|
hex_str_to_bytes,
|
||||||
nuparams,
|
nuparams,
|
||||||
|
nustr,
|
||||||
start_nodes,
|
start_nodes,
|
||||||
wait_and_assert_operationid_status,
|
wait_and_assert_operationid_status,
|
||||||
)
|
)
|
||||||
|
@ -133,7 +134,7 @@ class GetBlockTemplateTest(BitcoinTestFramework):
|
||||||
node.generate(15)
|
node.generate(15)
|
||||||
|
|
||||||
# at height 120, NU5 is not active
|
# at height 120, NU5 is not active
|
||||||
assert_equal(node.getblockchaininfo()['upgrades']['37519621']['status'], 'pending')
|
assert_equal(node.getblockchaininfo()['upgrades'][nustr(NU5_BRANCH_ID)]['status'], 'pending')
|
||||||
|
|
||||||
print("Testing getblocktemplate for pre-NU5")
|
print("Testing getblocktemplate for pre-NU5")
|
||||||
|
|
||||||
|
@ -155,7 +156,7 @@ class GetBlockTemplateTest(BitcoinTestFramework):
|
||||||
|
|
||||||
# Activate NU5, repeat the above cases
|
# Activate NU5, repeat the above cases
|
||||||
node.generate(7)
|
node.generate(7)
|
||||||
assert_equal(node.getblockchaininfo()['upgrades']['37519621']['status'], 'active')
|
assert_equal(node.getblockchaininfo()['upgrades'][nustr(NU5_BRANCH_ID)]['status'], 'active')
|
||||||
|
|
||||||
print("Testing getblocktemplate for post-NU5")
|
print("Testing getblocktemplate for post-NU5")
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,12 @@ from test_framework.util import (
|
||||||
assert_equal,
|
assert_equal,
|
||||||
start_nodes,
|
start_nodes,
|
||||||
nuparams,
|
nuparams,
|
||||||
|
nustr,
|
||||||
|
OVERWINTER_BRANCH_ID,
|
||||||
|
SAPLING_BRANCH_ID,
|
||||||
|
BLOSSOM_BRANCH_ID,
|
||||||
HEARTWOOD_BRANCH_ID,
|
HEARTWOOD_BRANCH_ID,
|
||||||
|
CANOPY_BRANCH_ID,
|
||||||
NU5_BRANCH_ID,
|
NU5_BRANCH_ID,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -40,32 +45,32 @@ class NuparamsTest(BitcoinTestFramework):
|
||||||
assert_equal(bci['blocks'], 0)
|
assert_equal(bci['blocks'], 0)
|
||||||
upgrades = bci['upgrades']
|
upgrades = bci['upgrades']
|
||||||
|
|
||||||
overwinter = upgrades['5ba81b19']
|
overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)]
|
||||||
assert_equal(overwinter['name'], 'Overwinter')
|
assert_equal(overwinter['name'], 'Overwinter')
|
||||||
assert_equal(overwinter['activationheight'], 1)
|
assert_equal(overwinter['activationheight'], 1)
|
||||||
assert_equal(overwinter['status'], 'pending')
|
assert_equal(overwinter['status'], 'pending')
|
||||||
|
|
||||||
sapling = upgrades['76b809bb']
|
sapling = upgrades[nustr(SAPLING_BRANCH_ID)]
|
||||||
assert_equal(sapling['name'], 'Sapling')
|
assert_equal(sapling['name'], 'Sapling')
|
||||||
assert_equal(sapling['activationheight'], 1)
|
assert_equal(sapling['activationheight'], 1)
|
||||||
assert_equal(sapling['status'], 'pending')
|
assert_equal(sapling['status'], 'pending')
|
||||||
|
|
||||||
blossom = upgrades['2bb40e60']
|
blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)]
|
||||||
assert_equal(blossom['name'], 'Blossom')
|
assert_equal(blossom['name'], 'Blossom')
|
||||||
assert_equal(blossom['activationheight'], 3)
|
assert_equal(blossom['activationheight'], 3)
|
||||||
assert_equal(blossom['status'], 'pending')
|
assert_equal(blossom['status'], 'pending')
|
||||||
|
|
||||||
heartwood = upgrades['f5b9230b']
|
heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)]
|
||||||
assert_equal(heartwood['name'], 'Heartwood')
|
assert_equal(heartwood['name'], 'Heartwood')
|
||||||
assert_equal(heartwood['activationheight'], 3)
|
assert_equal(heartwood['activationheight'], 3)
|
||||||
assert_equal(heartwood['status'], 'pending')
|
assert_equal(heartwood['status'], 'pending')
|
||||||
|
|
||||||
canopy = upgrades['e9ff75a6']
|
canopy = upgrades[nustr(CANOPY_BRANCH_ID)]
|
||||||
assert_equal(canopy['name'], 'Canopy')
|
assert_equal(canopy['name'], 'Canopy')
|
||||||
assert_equal(canopy['activationheight'], 5)
|
assert_equal(canopy['activationheight'], 5)
|
||||||
assert_equal(canopy['status'], 'pending')
|
assert_equal(canopy['status'], 'pending')
|
||||||
|
|
||||||
nu5 = upgrades['37519621']
|
nu5 = upgrades[nustr(NU5_BRANCH_ID)]
|
||||||
assert_equal(nu5['name'], 'NU5')
|
assert_equal(nu5['name'], 'NU5')
|
||||||
assert_equal(nu5['activationheight'], 5)
|
assert_equal(nu5['activationheight'], 5)
|
||||||
assert_equal(nu5['status'], 'pending')
|
assert_equal(nu5['status'], 'pending')
|
||||||
|
@ -77,32 +82,32 @@ class NuparamsTest(BitcoinTestFramework):
|
||||||
assert_equal(bci['blocks'], 1)
|
assert_equal(bci['blocks'], 1)
|
||||||
upgrades = bci['upgrades']
|
upgrades = bci['upgrades']
|
||||||
|
|
||||||
overwinter = upgrades['5ba81b19']
|
overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)]
|
||||||
assert_equal(overwinter['name'], 'Overwinter')
|
assert_equal(overwinter['name'], 'Overwinter')
|
||||||
assert_equal(overwinter['activationheight'], 1)
|
assert_equal(overwinter['activationheight'], 1)
|
||||||
assert_equal(overwinter['status'], 'active')
|
assert_equal(overwinter['status'], 'active')
|
||||||
|
|
||||||
sapling = upgrades['76b809bb']
|
sapling = upgrades[nustr(SAPLING_BRANCH_ID)]
|
||||||
assert_equal(sapling['name'], 'Sapling')
|
assert_equal(sapling['name'], 'Sapling')
|
||||||
assert_equal(sapling['activationheight'], 1)
|
assert_equal(sapling['activationheight'], 1)
|
||||||
assert_equal(sapling['status'], 'active')
|
assert_equal(sapling['status'], 'active')
|
||||||
|
|
||||||
blossom = upgrades['2bb40e60']
|
blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)]
|
||||||
assert_equal(blossom['name'], 'Blossom')
|
assert_equal(blossom['name'], 'Blossom')
|
||||||
assert_equal(blossom['activationheight'], 3)
|
assert_equal(blossom['activationheight'], 3)
|
||||||
assert_equal(blossom['status'], 'pending')
|
assert_equal(blossom['status'], 'pending')
|
||||||
|
|
||||||
heartwood = upgrades['f5b9230b']
|
heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)]
|
||||||
assert_equal(heartwood['name'], 'Heartwood')
|
assert_equal(heartwood['name'], 'Heartwood')
|
||||||
assert_equal(heartwood['activationheight'], 3)
|
assert_equal(heartwood['activationheight'], 3)
|
||||||
assert_equal(heartwood['status'], 'pending')
|
assert_equal(heartwood['status'], 'pending')
|
||||||
|
|
||||||
canopy = upgrades['e9ff75a6']
|
canopy = upgrades[nustr(CANOPY_BRANCH_ID)]
|
||||||
assert_equal(canopy['name'], 'Canopy')
|
assert_equal(canopy['name'], 'Canopy')
|
||||||
assert_equal(canopy['activationheight'], 5)
|
assert_equal(canopy['activationheight'], 5)
|
||||||
assert_equal(canopy['status'], 'pending')
|
assert_equal(canopy['status'], 'pending')
|
||||||
|
|
||||||
nu5 = upgrades['37519621']
|
nu5 = upgrades[nustr(NU5_BRANCH_ID)]
|
||||||
assert_equal(nu5['name'], 'NU5')
|
assert_equal(nu5['name'], 'NU5')
|
||||||
assert_equal(nu5['activationheight'], 5)
|
assert_equal(nu5['activationheight'], 5)
|
||||||
assert_equal(nu5['status'], 'pending')
|
assert_equal(nu5['status'], 'pending')
|
||||||
|
@ -112,32 +117,32 @@ class NuparamsTest(BitcoinTestFramework):
|
||||||
assert_equal(bci['blocks'], 2)
|
assert_equal(bci['blocks'], 2)
|
||||||
upgrades = bci['upgrades']
|
upgrades = bci['upgrades']
|
||||||
|
|
||||||
overwinter = upgrades['5ba81b19']
|
overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)]
|
||||||
assert_equal(overwinter['name'], 'Overwinter')
|
assert_equal(overwinter['name'], 'Overwinter')
|
||||||
assert_equal(overwinter['activationheight'], 1)
|
assert_equal(overwinter['activationheight'], 1)
|
||||||
assert_equal(overwinter['status'], 'active')
|
assert_equal(overwinter['status'], 'active')
|
||||||
|
|
||||||
sapling = upgrades['76b809bb']
|
sapling = upgrades[nustr(SAPLING_BRANCH_ID)]
|
||||||
assert_equal(sapling['name'], 'Sapling')
|
assert_equal(sapling['name'], 'Sapling')
|
||||||
assert_equal(sapling['activationheight'], 1)
|
assert_equal(sapling['activationheight'], 1)
|
||||||
assert_equal(sapling['status'], 'active')
|
assert_equal(sapling['status'], 'active')
|
||||||
|
|
||||||
blossom = upgrades['2bb40e60']
|
blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)]
|
||||||
assert_equal(blossom['name'], 'Blossom')
|
assert_equal(blossom['name'], 'Blossom')
|
||||||
assert_equal(blossom['activationheight'], 3)
|
assert_equal(blossom['activationheight'], 3)
|
||||||
assert_equal(blossom['status'], 'pending')
|
assert_equal(blossom['status'], 'pending')
|
||||||
|
|
||||||
heartwood = upgrades['f5b9230b']
|
heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)]
|
||||||
assert_equal(heartwood['name'], 'Heartwood')
|
assert_equal(heartwood['name'], 'Heartwood')
|
||||||
assert_equal(heartwood['activationheight'], 3)
|
assert_equal(heartwood['activationheight'], 3)
|
||||||
assert_equal(heartwood['status'], 'pending')
|
assert_equal(heartwood['status'], 'pending')
|
||||||
|
|
||||||
canopy = upgrades['e9ff75a6']
|
canopy = upgrades[nustr(CANOPY_BRANCH_ID)]
|
||||||
assert_equal(canopy['name'], 'Canopy')
|
assert_equal(canopy['name'], 'Canopy')
|
||||||
assert_equal(canopy['activationheight'], 5)
|
assert_equal(canopy['activationheight'], 5)
|
||||||
assert_equal(canopy['status'], 'pending')
|
assert_equal(canopy['status'], 'pending')
|
||||||
|
|
||||||
nu5 = upgrades['37519621']
|
nu5 = upgrades[nustr(NU5_BRANCH_ID)]
|
||||||
assert_equal(nu5['name'], 'NU5')
|
assert_equal(nu5['name'], 'NU5')
|
||||||
assert_equal(nu5['activationheight'], 5)
|
assert_equal(nu5['activationheight'], 5)
|
||||||
assert_equal(nu5['status'], 'pending')
|
assert_equal(nu5['status'], 'pending')
|
||||||
|
@ -147,32 +152,32 @@ class NuparamsTest(BitcoinTestFramework):
|
||||||
assert_equal(bci['blocks'], 4)
|
assert_equal(bci['blocks'], 4)
|
||||||
upgrades = bci['upgrades']
|
upgrades = bci['upgrades']
|
||||||
|
|
||||||
overwinter = upgrades['5ba81b19']
|
overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)]
|
||||||
assert_equal(overwinter['name'], 'Overwinter')
|
assert_equal(overwinter['name'], 'Overwinter')
|
||||||
assert_equal(overwinter['activationheight'], 1)
|
assert_equal(overwinter['activationheight'], 1)
|
||||||
assert_equal(overwinter['status'], 'active')
|
assert_equal(overwinter['status'], 'active')
|
||||||
|
|
||||||
sapling = upgrades['76b809bb']
|
sapling = upgrades[nustr(SAPLING_BRANCH_ID)]
|
||||||
assert_equal(sapling['name'], 'Sapling')
|
assert_equal(sapling['name'], 'Sapling')
|
||||||
assert_equal(sapling['activationheight'], 1)
|
assert_equal(sapling['activationheight'], 1)
|
||||||
assert_equal(sapling['status'], 'active')
|
assert_equal(sapling['status'], 'active')
|
||||||
|
|
||||||
blossom = upgrades['2bb40e60']
|
blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)]
|
||||||
assert_equal(blossom['name'], 'Blossom')
|
assert_equal(blossom['name'], 'Blossom')
|
||||||
assert_equal(blossom['activationheight'], 3)
|
assert_equal(blossom['activationheight'], 3)
|
||||||
assert_equal(blossom['status'], 'active')
|
assert_equal(blossom['status'], 'active')
|
||||||
|
|
||||||
heartwood = upgrades['f5b9230b']
|
heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)]
|
||||||
assert_equal(heartwood['name'], 'Heartwood')
|
assert_equal(heartwood['name'], 'Heartwood')
|
||||||
assert_equal(heartwood['activationheight'], 3)
|
assert_equal(heartwood['activationheight'], 3)
|
||||||
assert_equal(heartwood['status'], 'active')
|
assert_equal(heartwood['status'], 'active')
|
||||||
|
|
||||||
canopy = upgrades['e9ff75a6']
|
canopy = upgrades[nustr(CANOPY_BRANCH_ID)]
|
||||||
assert_equal(canopy['name'], 'Canopy')
|
assert_equal(canopy['name'], 'Canopy')
|
||||||
assert_equal(canopy['activationheight'], 5)
|
assert_equal(canopy['activationheight'], 5)
|
||||||
assert_equal(canopy['status'], 'pending')
|
assert_equal(canopy['status'], 'pending')
|
||||||
|
|
||||||
nu5 = upgrades['37519621']
|
nu5 = upgrades[nustr(NU5_BRANCH_ID)]
|
||||||
assert_equal(nu5['name'], 'NU5')
|
assert_equal(nu5['name'], 'NU5')
|
||||||
assert_equal(nu5['activationheight'], 5)
|
assert_equal(nu5['activationheight'], 5)
|
||||||
assert_equal(nu5['status'], 'pending')
|
assert_equal(nu5['status'], 'pending')
|
||||||
|
@ -182,32 +187,32 @@ class NuparamsTest(BitcoinTestFramework):
|
||||||
assert_equal(bci['blocks'], 5)
|
assert_equal(bci['blocks'], 5)
|
||||||
upgrades = bci['upgrades']
|
upgrades = bci['upgrades']
|
||||||
|
|
||||||
overwinter = upgrades['5ba81b19']
|
overwinter = upgrades[nustr(OVERWINTER_BRANCH_ID)]
|
||||||
assert_equal(overwinter['name'], 'Overwinter')
|
assert_equal(overwinter['name'], 'Overwinter')
|
||||||
assert_equal(overwinter['activationheight'], 1)
|
assert_equal(overwinter['activationheight'], 1)
|
||||||
assert_equal(overwinter['status'], 'active')
|
assert_equal(overwinter['status'], 'active')
|
||||||
|
|
||||||
sapling = upgrades['76b809bb']
|
sapling = upgrades[nustr(SAPLING_BRANCH_ID)]
|
||||||
assert_equal(sapling['name'], 'Sapling')
|
assert_equal(sapling['name'], 'Sapling')
|
||||||
assert_equal(sapling['activationheight'], 1)
|
assert_equal(sapling['activationheight'], 1)
|
||||||
assert_equal(sapling['status'], 'active')
|
assert_equal(sapling['status'], 'active')
|
||||||
|
|
||||||
blossom = upgrades['2bb40e60']
|
blossom = upgrades[nustr(BLOSSOM_BRANCH_ID)]
|
||||||
assert_equal(blossom['name'], 'Blossom')
|
assert_equal(blossom['name'], 'Blossom')
|
||||||
assert_equal(blossom['activationheight'], 3)
|
assert_equal(blossom['activationheight'], 3)
|
||||||
assert_equal(blossom['status'], 'active')
|
assert_equal(blossom['status'], 'active')
|
||||||
|
|
||||||
heartwood = upgrades['f5b9230b']
|
heartwood = upgrades[nustr(HEARTWOOD_BRANCH_ID)]
|
||||||
assert_equal(heartwood['name'], 'Heartwood')
|
assert_equal(heartwood['name'], 'Heartwood')
|
||||||
assert_equal(heartwood['activationheight'], 3)
|
assert_equal(heartwood['activationheight'], 3)
|
||||||
assert_equal(heartwood['status'], 'active')
|
assert_equal(heartwood['status'], 'active')
|
||||||
|
|
||||||
canopy = upgrades['e9ff75a6']
|
canopy = upgrades[nustr(CANOPY_BRANCH_ID)]
|
||||||
assert_equal(canopy['name'], 'Canopy')
|
assert_equal(canopy['name'], 'Canopy')
|
||||||
assert_equal(canopy['activationheight'], 5)
|
assert_equal(canopy['activationheight'], 5)
|
||||||
assert_equal(canopy['status'], 'active')
|
assert_equal(canopy['status'], 'active')
|
||||||
|
|
||||||
nu5 = upgrades['37519621']
|
nu5 = upgrades[nustr(NU5_BRANCH_ID)]
|
||||||
assert_equal(nu5['name'], 'NU5')
|
assert_equal(nu5['name'], 'NU5')
|
||||||
assert_equal(nu5['activationheight'], 5)
|
assert_equal(nu5['activationheight'], 5)
|
||||||
assert_equal(nu5['status'], 'active')
|
assert_equal(nu5['status'], 'active')
|
||||||
|
|
|
@ -666,5 +666,8 @@ def check_node_log(self, node_number, line_to_check, stop_node = True):
|
||||||
return n
|
return n
|
||||||
raise AssertionError(repr(line_to_check) + " not found")
|
raise AssertionError(repr(line_to_check) + " not found")
|
||||||
|
|
||||||
|
def nustr(branch_id):
|
||||||
|
return '%08x' % branch_id
|
||||||
|
|
||||||
def nuparams(branch_id, height):
|
def nuparams(branch_id, height):
|
||||||
return '-nuparams=%x:%d' % (branch_id, height)
|
return '-nuparams=%s:%d' % (nustr(branch_id), height)
|
||||||
|
|
Loading…
Reference in New Issue