Skip to content

Commit

Permalink
Fix other bug in initpegoutwallet descriptor parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed Sep 30, 2019
1 parent bf86c44 commit 651b28c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5013,7 +5013,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
Expand Down
2 changes: 2 additions & 0 deletions test/functional/feature_pak.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def run_test(self):

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])
Expand Down

0 comments on commit 651b28c

Please sign in to comment.