Skip to content

Commit b5d3987

Browse files
committed
Take non-importing keys into account for spendability warning in descriptor import
1 parent 6e59700 commit b5d3987

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/wallet/rpcdump.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,9 @@ static UniValue ProcessImportDescriptor(ImportData& import_data, std::map<CKeyID
11971197
bool spendable = std::all_of(pubkey_map.begin(), pubkey_map.end(),
11981198
[&](const std::pair<CKeyID, CPubKey>& used_key) {
11991199
return privkey_map.count(used_key.first) > 0;
1200+
}) && std::all_of(import_data.key_origins.begin(), import_data.key_origins.end(),
1201+
[&](const std::pair<CKeyID, std::pair<CPubKey, KeyOriginInfo>>& entry) {
1202+
return privkey_map.count(entry.first) > 0;
12001203
});
12011204
if (!watch_only && !spendable) {
12021205
warnings.push_back("Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag.");

test/functional/wallet_importmulti.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ def run_test(self):
629629
self.log.info("Should import a 1-of-2 bare multisig from descriptor")
630630
self.test_importmulti({"desc": descsum_create("multi(1," + key1.pubkey + "," + key2.pubkey + ")"),
631631
"timestamp": "now"},
632-
success=True)
632+
success=True,
633+
warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."])
633634
self.log.info("Should not treat individual keys from the imported bare multisig as watchonly")
634635
test_address(self.nodes[1],
635636
key1.p2pkh_addr,

0 commit comments

Comments
 (0)