aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-06-27 18:09:49 -0400
committerAndrew Chow <achow101-github@achow101.com>2019-07-24 11:42:37 -0400
commita00d1e5ec5eb019f8bbeb060a2b09e341d360fe5 (patch)
treefdf08cfb0b1e1a0d354b5fe5e5b6a3364c83d2e7 /src
parentc6a827424711333f6f66cf5f9d79e0e6884769de (diff)
Have importpubkey use CWallet's ImportScriptPubKeys and ImportPubKeys functions
Behavior changes: * If any scripts for the pubkey were already in the wallet, their timestamps will be set to 1 and label updated
Diffstat (limited to 'src')
-rw-r--r--src/wallet/rpcdump.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 7f192e9364..7b2a1a3377 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -538,11 +538,16 @@ UniValue importpubkey(const JSONRPCRequest& request)
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
+ std::set<CScript> 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)
{