diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -617,11 +617,20 @@ auto locked_chain = pwallet->chain().lock(); LOCK(pwallet->cs_wallet); + std::set script_pub_keys; for (const auto &dest : GetAllDestinationsForKey(pubKey)) { - ImportAddress(pwallet, dest, strLabel); + script_pub_keys.insert(GetScriptForDestination(dest)); } - ImportScript(pwallet, GetScriptForRawPubKey(pubKey), strLabel, false); - pwallet->LearnAllRelatedScripts(pubKey); + + pwallet->MarkDirty(); + + pwallet->ImportScriptPubKeys(strLabel, script_pub_keys, + true /* have_solving_data */, + true /* apply_label */, 1 /* timestamp */); + + pwallet->ImportPubKeys({pubKey.GetID()}, {{pubKey.GetID(), pubKey}}, + {} /* key_origins */, false /* add_keypool */, + false /* internal */, 1 /* timestamp */); } if (fRescan) { RescanWallet(*pwallet, reserver);