wallet: fix importdescriptor silent fail

This commit is contained in:
Ivan Metlushko
2020-10-15 18:02:58 +07:00
parent 711ddce943
commit 538be4219a
3 changed files with 16 additions and 2 deletions

View File

@@ -1522,7 +1522,9 @@ static UniValue ProcessDescriptorImport(CWallet * const pwallet, const UniValue&
// Need to ExpandPrivate to check if private keys are available for all pubkeys
FlatSigningProvider expand_keys;
std::vector<CScript> scripts;
parsed_desc->Expand(0, keys, scripts, expand_keys);
if (!parsed_desc->Expand(0, keys, scripts, expand_keys)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Cannot expand descriptor. Probably because of hardened derivations without private keys provided");
}
parsed_desc->ExpandPrivate(0, keys, expand_keys);
// Check if all private keys are provided