MCPcopy Create free account
hub / github.com/LUX-Core/lux / keypoolrefill

Function keypoolrefill

src/rpcwallet.cpp:2055–2084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2053
2054
2055UniValue keypoolrefill(const UniValue& params, bool fHelp)
2056{
2057 if (fHelp || params.size() > 1)
2058 throw runtime_error(
2059 "keypoolrefill ( newsize )\n"
2060 "\nFills the keypool." +
2061 HelpRequiringPassphrase() + "\n"
2062 "\nArguments\n"
2063 "1. newsize (numeric, optional, default=100) The new keypool size\n"
2064 "\nExamples:\n" +
2065 HelpExampleCli("keypoolrefill", "") + HelpExampleRpc("keypoolrefill", ""));
2066
2067 LOCK2(cs_main, pwalletMain->cs_wallet);
2068
2069 // 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool
2070 unsigned int kpSize = 0;
2071 if (params.size() > 0) {
2072 if (params[0].get_int() < 0)
2073 throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected valid size.");
2074 kpSize = (unsigned int)params[0].get_int();
2075 }
2076
2077 EnsureWalletIsUnlocked();
2078 pwalletMain->TopUpKeyPool(kpSize);
2079
2080 if (pwalletMain->GetKeyPoolSize() < (pwalletMain->IsHDEnabled() ? kpSize * 2 : kpSize))
2081 throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool.");
2082
2083 return NullUniValue;
2084}
2085
2086
2087static void LockWallet(CWallet* pWallet)

Callers

nothing calls this directly

Calls 10

HelpRequiringPassphraseFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
JSONRPCErrorFunction · 0.85
EnsureWalletIsUnlockedFunction · 0.85
TopUpKeyPoolMethod · 0.80
GetKeyPoolSizeMethod · 0.80
IsHDEnabledMethod · 0.80
sizeMethod · 0.45
get_intMethod · 0.45

Tested by

no test coverage detected