mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Add newkeypool RPC to flush the keypool
This commit is contained in:
parent
16ccb3a1cd
commit
22cc797ca5
1 changed files with 28 additions and 0 deletions
|
@ -1892,6 +1892,33 @@ static RPCHelpMan keypoolrefill()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static RPCHelpMan newkeypool()
|
||||||
|
{
|
||||||
|
return RPCHelpMan{"newkeypool",
|
||||||
|
"\nEntirely clears and refills the keypool."+
|
||||||
|
HELP_REQUIRING_PASSPHRASE,
|
||||||
|
{},
|
||||||
|
RPCResult{RPCResult::Type::NONE, "", ""},
|
||||||
|
RPCExamples{
|
||||||
|
HelpExampleCli("newkeypool", "")
|
||||||
|
+ HelpExampleRpc("newkeypool", "")
|
||||||
|
},
|
||||||
|
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
|
||||||
|
{
|
||||||
|
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest(request);
|
||||||
|
if (!pwallet) return NullUniValue;
|
||||||
|
|
||||||
|
LOCK(pwallet->cs_wallet);
|
||||||
|
|
||||||
|
LegacyScriptPubKeyMan& spk_man = EnsureLegacyScriptPubKeyMan(*pwallet, true);
|
||||||
|
spk_man.NewKeyPool();
|
||||||
|
|
||||||
|
return NullUniValue;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static RPCHelpMan walletpassphrase()
|
static RPCHelpMan walletpassphrase()
|
||||||
{
|
{
|
||||||
return RPCHelpMan{"walletpassphrase",
|
return RPCHelpMan{"walletpassphrase",
|
||||||
|
@ -4773,6 +4800,7 @@ static const CRPCCommand commands[] =
|
||||||
{ "wallet", &listwallets, },
|
{ "wallet", &listwallets, },
|
||||||
{ "wallet", &loadwallet, },
|
{ "wallet", &loadwallet, },
|
||||||
{ "wallet", &lockunspent, },
|
{ "wallet", &lockunspent, },
|
||||||
|
{ "wallet", &newkeypool, },
|
||||||
{ "wallet", &removeprunedfunds, },
|
{ "wallet", &removeprunedfunds, },
|
||||||
{ "wallet", &rescanblockchain, },
|
{ "wallet", &rescanblockchain, },
|
||||||
{ "wallet", &send, },
|
{ "wallet", &send, },
|
||||||
|
|
Loading…
Add table
Reference in a new issue