Skip to content

Commit 6e59700

Browse files
committed
Import all origin info in importmulti; even for non-importing pubkeys
1 parent 9a93c91 commit 6e59700

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/wallet/rpcdump.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,10 @@ static UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, con
12741274
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding key to wallet");
12751275
}
12761276
pwallet->UpdateTimeFirstKey(timestamp);
1277-
}
1277+
}
1278+
for (const auto& entry : import_data.key_origins) {
1279+
pwallet->AddKeyOrigin(entry.second.first, entry.second.second);
1280+
}
12781281
for (const CKeyID& id : ordered_pubkeys) {
12791282
auto entry = pubkey_map.find(id);
12801283
if (entry == pubkey_map.end()) {
@@ -1285,10 +1288,6 @@ static UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, con
12851288
if (!pwallet->GetPubKey(id, temp) && !pwallet->AddWatchOnly(GetScriptForRawPubKey(pubkey), timestamp)) {
12861289
throw JSONRPCError(RPC_WALLET_ERROR, "Error adding address to wallet");
12871290
}
1288-
const auto& key_orig_it = import_data.key_origins.find(id);
1289-
if (key_orig_it != import_data.key_origins.end()) {
1290-
pwallet->AddKeyOrigin(pubkey, key_orig_it->second.second);
1291-
}
12921291
pwallet->mapKeyMetadata[id].nCreateTime = timestamp;
12931292

12941293
// Add to keypool only works with pubkeys

0 commit comments

Comments
 (0)