From 5492cefcc65cb6c04655b58d43fda6b1f81fdee7 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Fri, 3 May 2019 16:56:40 +0100 Subject: [PATCH] MERGE-FIX: Fix fedpeg and pak tests for 0.18.0 --- test/functional/feature_fedpeg.py | 16 +++++++++++----- test/functional/feature_pak.py | 8 +++++--- test/functional/test_framework/test_node.py | 1 - 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/test/functional/feature_fedpeg.py b/test/functional/feature_fedpeg.py index 0914edf65b..71295fb734 100755 --- a/test/functional/feature_fedpeg.py +++ b/test/functional/feature_fedpeg.py @@ -73,13 +73,15 @@ class FedPegTest(BitcoinTestFramework): "-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) @@ -106,15 +108,16 @@ class FedPegTest(BitcoinTestFramework): '-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, ]) @@ -167,9 +170,12 @@ class FedPegTest(BitcoinTestFramework): #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"] diff --git a/test/functional/feature_pak.py b/test/functional/feature_pak.py index dfc6bc614f..f03b67d8e2 100755 --- a/test/functional/feature_pak.py +++ b/test/functional/feature_pak.py @@ -52,6 +52,11 @@ class PAKTest (BitcoinTestFramework): 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) @@ -329,9 +334,6 @@ class PAKTest (BitcoinTestFramework): 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) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 536530804a..0c87b5fbd6 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -129,7 +129,6 @@ class TestNode(): 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]