aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Metlushko <[email protected]>2020-10-15 18:02:58 +0700
committerIvan Metlushko <[email protected]>2020-10-15 18:02:58 +0700
commit538be4219ae7e65862e4aff540af88c9421e6061 (patch)
treece25540988e4834c81077c6f9b895522e51ef211 /src
parentMerge #20131: test: Remove unused nVersion=1 in p2p tests (diff)
downloaddiscoin-538be4219ae7e65862e4aff540af88c9421e6061.tar.xz
discoin-538be4219ae7e65862e4aff540af88c9421e6061.zip
wallet: fix importdescriptor silent fail
Diffstat (limited to 'src')
-rw-r--r--src/wallet/rpcdump.cpp4
-rw-r--r--src/wallet/wallet.cpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 7dcab46ad..fe621382a 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -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
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 6b7d05fdf..018c4afbf 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -4555,7 +4555,10 @@ ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const Flat
}
// Top up key pool, the manager will generate new scriptPubKeys internally
- new_spk_man->TopUp();
+ if (!new_spk_man->TopUp()) {
+ WalletLogPrintf("Could not top up scriptPubKeys\n");
+ return nullptr;
+ }
// Apply the label if necessary
// Note: we disable labels for ranged descriptors