aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcdump.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-11-09 17:18:27 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-11-09 20:19:00 +0100
commit1dfe19e2840b16c014674a890ba58a43fe039687 (patch)
treecf6cda228de59a32e5345104df39552daa5da342 /src/wallet/rpcdump.cpp
parent79a3b59cc70622fbadc43ade5fce31fcf94d852d (diff)
parent538be4219ae7e65862e4aff540af88c9421e6061 (diff)
downloadbitcoin-1dfe19e2840b16c014674a890ba58a43fe039687.tar.xz
Merge #20153: wallet: do not import a descriptor with hardened derivations into a watch-only wallet
538be4219ae7e65862e4aff540af88c9421e6061 wallet: fix importdescriptor silent fail (Ivan Metlushko) Pull request description: Currently `importdescriptor` command will successfully import a descriptor with hardened derivations into a watch-only wallet while silently failing to expand the descriptor to fill the cache. This leads to a broken wallet state and failure to load such wallet due to missing cache on subsequent restart. ACKs for top commit: laanwj: Code review ACK 538be4219ae7e65862e4aff540af88c9421e6061 achow101: ACK 538be4219ae7e65862e4aff540af88c9421e6061 meshcollider: utACK 538be4219ae7e65862e4aff540af88c9421e6061 Tree-SHA512: 4bdd0ab4437d55b3f1a79c3a300a0b186089155c020fe220a73d0cce274de47d90371d88918d39fd795f9fccf8db328f1e322d29a6062f9ce94a1c254398f004
Diffstat (limited to 'src/wallet/rpcdump.cpp')
-rw-r--r--src/wallet/rpcdump.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 17bdc06c78..6b46868d10 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -1523,7 +1523,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