aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2019-04-06 08:23:19 -0700
committerMeshCollider <dobsonsa68@gmail.com>2019-04-16 19:35:25 +1200
commit235550d01992555a316c9c4639f5bec6255a244f (patch)
treeb3ed6c367eb72a1365bc4e0e6f901251dfcf7cac /src/wallet
parent802dcd37d196aab07f377938d851d7eaf095b03b (diff)
downloadbitcoin-235550d01992555a316c9c4639f5bec6255a244f.tar.xz
Take non-importing keys into account for spendability warning in descriptor import
Github-Pull: #15749 Rebased-From: b5d39877242504160a7f2c24c60c07a845d7a064
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpcdump.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index a809a5e782..ed9742e6c2 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -1193,6 +1193,9 @@ static UniValue ProcessImportDescriptor(ImportData& import_data, std::map<CKeyID
bool spendable = std::all_of(pubkey_map.begin(), pubkey_map.end(),
[&](const std::pair<CKeyID, CPubKey>& used_key) {
return privkey_map.count(used_key.first) > 0;
+ }) && std::all_of(import_data.key_origins.begin(), import_data.key_origins.end(),
+ [&](const std::pair<CKeyID, std::pair<CPubKey, KeyOriginInfo>>& entry) {
+ return privkey_map.count(entry.first) > 0;
});
if (!watch_only && !spendable) {
warnings.push_back("Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag.");