Skip to content

Commit 235550d

Browse files
sipameshcollider
authored andcommitted
Take non-importing keys into account for spendability warning in descriptor import
Github-Pull: #15749 Rebased-From: b5d3987
1 parent 802dcd3 commit 235550d

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
@@ -1193,6 +1193,9 @@ static UniValue ProcessImportDescriptor(ImportData& import_data, std::map<CKeyID
11931193
bool spendable = std::all_of(pubkey_map.begin(), pubkey_map.end(),
11941194
[&](const std::pair<CKeyID, CPubKey>& used_key) {
11951195
return privkey_map.count(used_key.first) > 0;
1196+
}) && std::all_of(import_data.key_origins.begin(), import_data.key_origins.end(),
1197+
[&](const std::pair<CKeyID, std::pair<CPubKey, KeyOriginInfo>>& entry) {
1198+
return privkey_map.count(entry.first) > 0;
11961199
});
11971200
if (!watch_only && !spendable) {
11981201
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
@@ -630,7 +630,8 @@ def run_test(self):
630630
self.log.info("Should import a 1-of-2 bare multisig from descriptor")
631631
self.test_importmulti({"desc": descsum_create("multi(1," + key1.pubkey + "," + key2.pubkey + ")"),
632632
"timestamp": "now"},
633-
success=True)
633+
success=True,
634+
warnings=["Some private keys are missing, outputs will be considered watchonly. If this is intentional, specify the watchonly flag."])
634635
self.log.info("Should not treat individual keys from the imported bare multisig as watchonly")
635636
test_address(self.nodes[1],
636637
key1.p2pkh_addr,

0 commit comments

Comments
 (0)