MCPcopy Create free account
hub / github.com/ElementsProject/elements / newkeypool

Function newkeypool

src/wallet/rpc/addresses.cpp:378–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378RPCHelpMan newkeypool()
379{
380 return RPCHelpMan{"newkeypool",
381 "\nEntirely clears and refills the keypool.\n"
382 "WARNING: On non-HD wallets, this will require a new backup immediately, to include the new keys.\n"
383 "When restoring a backup of an HD wallet created before the newkeypool command is run, funds received to\n"
384 "new addresses may not appear automatically. They have not been lost, but the wallet may not find them.\n"
385 "This can be fixed by running the newkeypool command on the backup and then rescanning, so the wallet\n"
386 "re-generates the required keys." +
387 HELP_REQUIRING_PASSPHRASE,
388 {},
389 RPCResult{RPCResult::Type::NONE, "", ""},
390 RPCExamples{
391 HelpExampleCli("newkeypool", "")
392 + HelpExampleRpc("newkeypool", "")
393 },
394 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
395{
396 std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
397 if (!pwallet) return NullUniValue;
398
399 LOCK(pwallet->cs_wallet);
400
401 LegacyScriptPubKeyMan& spk_man = EnsureLegacyScriptPubKeyMan(*pwallet, true);
402 spk_man.NewKeyPool();
403
404 return NullUniValue;
405},
406 };
407}
408
409
410class DescribeWalletAddressVisitor

Callers

nothing calls this directly

Calls 4

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
NewKeyPoolMethod · 0.80

Tested by

no test coverage detected