Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcdump.cpp
Show First 20 Lines • Show All 611 Lines • ▼ Show 20 Lines | if (!pubKey.IsFullyValid()) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Pubkey is not a valid public key"); | "Pubkey is not a valid public key"); | ||||
} | } | ||||
{ | { | ||||
auto locked_chain = pwallet->chain().lock(); | auto locked_chain = pwallet->chain().lock(); | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
std::set<CScript> script_pub_keys; | |||||
for (const auto &dest : GetAllDestinationsForKey(pubKey)) { | 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) { | if (fRescan) { | ||||
RescanWallet(*pwallet, reserver); | RescanWallet(*pwallet, reserver); | ||||
{ | { | ||||
auto locked_chain = pwallet->chain().lock(); | auto locked_chain = pwallet->chain().lock(); | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
pwallet->ReacceptWalletTransactions(*locked_chain); | pwallet->ReacceptWalletTransactions(*locked_chain); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,236 Lines • Show Last 20 Lines |