Fix other bug in initpegoutwallet descriptor parsing

This commit is contained in:
Steven Roose 2019-09-30 17:12:22 +02:00
parent 28dac17c4d
commit 55c4c6cd20
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
2 changed files with 3 additions and 1 deletions

View file

@ -5018,7 +5018,7 @@ UniValue initpegoutwallet(const JSONRPCRequest& request)
// Strip off leading key origin
if (xpub_str.find("]") != std::string::npos) {
xpub_str = xpub_str.substr(xpub_str.find("]"), std::string::npos);
xpub_str = xpub_str.substr(xpub_str.find("]")+1, std::string::npos);
}
// Strip off following range

View file

@ -63,6 +63,8 @@ class PAKTest (BitcoinTestFramework):
assert_raises_rpc_error(-8, "bip32_counter must be between 0 and 1,000,000,000, inclusive.", self.nodes[1].initpegoutwallet, xpub, 1000000001)
# Make sure we can also prepend the key origin to the xpub.
self.nodes[1].initpegoutwallet("pkh([deadbeef/44h/0h/0h]"+xpub+"/0/*)")
new_init = self.nodes[1].initpegoutwallet(xpub, 2)
assert_equal(self.nodes[1].getwalletpakinfo()["bip32_counter"], "2")
assert_equal(new_init["address_lookahead"][0], init_results[1]["address_lookahead"][2])