MERGE-FIX: Fix fedpeg and pak tests for 0.18.0

This commit is contained in:
Steven Roose 2019-05-03 16:56:40 +01:00
parent 1a2a93a5ff
commit 5492cefcc6
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
3 changed files with 16 additions and 9 deletions

View file

@ -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"]

View file

@ -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)

View file

@ -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]