Skip to content

Commit 5492cef

Browse files
committed
MERGE-FIX: Fix fedpeg and pak tests for 0.18.0
1 parent 1a2a93a commit 5492cef

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

test/functional/feature_fedpeg.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ def setup_network(self, split=False):
7373
"-anyonecanspendaremine",
7474
"-signblockscript=51", # OP_TRUE
7575
'-con_blocksubsidy=5000000000',
76-
"-pubkeyprefix=111",
77-
"-scriptprefix=196",
7876
])
7977

8078
self.add_nodes(1, [extra_args], chain=[parent_chain], binary=parent_binary, chain_in_args=[not self.options.parent_bitcoin])
8179
self.start_node(n)
8280
print("Node {} started".format(n))
81+
# set hard-coded mining keys for non-Elements chains
82+
if self.options.parent_bitcoin:
83+
self.nodes[0].set_deterministic_priv_key('2Mysp7FKKe52eoC2JmU46irt1dt58TpCvhQ', 'cTNbtVJmhx75RXomhYWSZAafuNNNKPd1cr2ZiUcAeukLNGrHWjvJ')
84+
self.nodes[1].set_deterministic_priv_key('2N19ZHF3nEzBXzkaZ3N5sVBJXQ8jZ7Udpg5', 'cRnDSw1JsjmYYEN6xxQvf5pqMENsRE584z6MdWfJ7v85c4ciitkk')
8385

8486
connect_nodes_bi(self.nodes, 0, 1)
8587
self.parentgenesisblockhash = self.nodes[0].getblockhash(0)
@@ -106,15 +108,16 @@ def setup_network(self, split=False):
106108
'-recheckpeginblockinterval=15', # Long enough to allow failure and repair before timeout
107109
'-parentpubkeyprefix=111',
108110
'-parentscriptprefix=196',
111+
'-parent_bech32_hrp=bcrt',
109112
# Turn of consistency checks that can cause assert when parent node stops
110113
# and a peg-in transaction fails this belt-and-suspenders check.
111114
'-checkmempool=0',
112115
]
113116
if not self.options.parent_bitcoin:
114117
extra_args.extend([
115-
'-parentpubkeyprefix=111',
116-
'-parentscriptprefix=196',
117-
"-parent_bech32_hrp=ert",
118+
'-parentpubkeyprefix=235',
119+
'-parentscriptprefix=75',
120+
'-parent_bech32_hrp=ert',
118121
'-con_parent_chain_signblockscript=51',
119122
'-con_parent_pegged_asset=%s' % parent_pegged_asset,
120123
])
@@ -167,9 +170,12 @@ def run_test(self):
167170
#parent2 = self.nodes[1]
168171
sidechain = self.nodes[2]
169172
sidechain2 = self.nodes[3]
173+
for node in self.nodes:
174+
node.importprivkey(privkey=node.get_deterministic_priv_key().key, label="mining")
170175

171176
parent.generate(101)
172177
sidechain.generate(101)
178+
self.log.info("sidechain info: {}".format(sidechain.getsidechaininfo()))
173179

174180
addrs = sidechain.getpeginaddress()
175181
addr = addrs["mainchain_address"]

test/functional/feature_pak.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ def skip_test_if_missing_module(self):
5252
self.skip_if_no_wallet()
5353

5454
def run_test(self):
55+
for node in self.nodes:
56+
addr = node.getnewaddress()
57+
unconf = node.validateaddress(addr)["unconfidential"]
58+
privkey = node.dumpprivkey(addr)
59+
node.set_deterministic_priv_key(unconf, privkey)
5560

5661
# Give novalidate 50 BTC
5762
self.nodes[i_novalidate].generate(101)
@@ -329,9 +334,6 @@ def compare(actual, expected):
329334

330335
assert_raises_rpc_error(-8, "bitcoin_descriptor must be a ranged descriptor.", self.nodes[i_pak1].initpegoutwallet, "pkh(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B)")
331336

332-
# key origins aren't supported in 0.17
333-
assert_raises_rpc_error(-8, "bitcoin_descriptor is not a valid descriptor string.", self.nodes[i_pak1].initpegoutwallet, "pkh([d34db33f/44'/0'/0']tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/*)")
334-
335337
# Peg out with each new type, check that destination script matches
336338
wpkh_desc = "wpkh("+xpub+"/0/*)"
337339
wpkh_info = self.nodes[i_pak1].initpegoutwallet(wpkh_desc)

test/functional/test_framework/test_node.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def get_deterministic_priv_key(self):
129129
if self.deterministic_priv_key is not None:
130130
self.log.debug("Custom deterministic_priv_key: {}".format(self.deterministic_priv_key))
131131
return self.deterministic_priv_key
132-
assert(self.chain == "elementsregtest")
133132

134133
return PRIV_KEYS[self.index]
135134

0 commit comments

Comments
 (0)