Skip to content

Commit

Permalink
MERGE-FIX: Fix fedpeg and pak tests for 0.18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed May 14, 2019
1 parent 1a2a93a commit 5492cef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
16 changes: 11 additions & 5 deletions test/functional/feature_fedpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ def setup_network(self, split=False):
"-anyonecanspendaremine",
"-signblockscript=51", # OP_TRUE
'-con_blocksubsidy=5000000000',
"-pubkeyprefix=111",
"-scriptprefix=196",
])

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

connect_nodes_bi(self.nodes, 0, 1)
self.parentgenesisblockhash = self.nodes[0].getblockhash(0)
Expand All @@ -106,15 +108,16 @@ def setup_network(self, split=False):
'-recheckpeginblockinterval=15', # Long enough to allow failure and repair before timeout
'-parentpubkeyprefix=111',
'-parentscriptprefix=196',
'-parent_bech32_hrp=bcrt',
# Turn of consistency checks that can cause assert when parent node stops
# and a peg-in transaction fails this belt-and-suspenders check.
'-checkmempool=0',
]
if not self.options.parent_bitcoin:
extra_args.extend([
'-parentpubkeyprefix=111',
'-parentscriptprefix=196',
"-parent_bech32_hrp=ert",
'-parentpubkeyprefix=235',
'-parentscriptprefix=75',
'-parent_bech32_hrp=ert',
'-con_parent_chain_signblockscript=51',
'-con_parent_pegged_asset=%s' % parent_pegged_asset,
])
Expand Down Expand Up @@ -167,9 +170,12 @@ def run_test(self):
#parent2 = self.nodes[1]
sidechain = self.nodes[2]
sidechain2 = self.nodes[3]
for node in self.nodes:
node.importprivkey(privkey=node.get_deterministic_priv_key().key, label="mining")

parent.generate(101)
sidechain.generate(101)
self.log.info("sidechain info: {}".format(sidechain.getsidechaininfo()))

addrs = sidechain.getpeginaddress()
addr = addrs["mainchain_address"]
Expand Down
8 changes: 5 additions & 3 deletions test/functional/feature_pak.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ def skip_test_if_missing_module(self):
self.skip_if_no_wallet()

def run_test(self):
for node in self.nodes:
addr = node.getnewaddress()
unconf = node.validateaddress(addr)["unconfidential"]
privkey = node.dumpprivkey(addr)
node.set_deterministic_priv_key(unconf, privkey)

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

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

# key origins aren't supported in 0.17
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/*)")

# Peg out with each new type, check that destination script matches
wpkh_desc = "wpkh("+xpub+"/0/*)"
wpkh_info = self.nodes[i_pak1].initpegoutwallet(wpkh_desc)
Expand Down
1 change: 0 additions & 1 deletion test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def get_deterministic_priv_key(self):
if self.deterministic_priv_key is not None:
self.log.debug("Custom deterministic_priv_key: {}".format(self.deterministic_priv_key))
return self.deterministic_priv_key
assert(self.chain == "elementsregtest")

return PRIV_KEYS[self.index]

Expand Down

0 comments on commit 5492cef

Please sign in to comment.