Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 792 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"a fee that is high enough to get reliably included in the next " | "a fee that is high enough to get reliably included in the next " | ||||
"block.\n" | "block.\n" | ||||
"\nExample:\n" + | "\nExample:\n" + | ||||
HelpExampleCli("estimatefee", "6")); | HelpExampleCli("estimatefee", "6")); | ||||
} | } | ||||
RPCTypeCheck(request.params, {UniValue::VNUM}); | RPCTypeCheck(request.params, {UniValue::VNUM}); | ||||
int nBlocks = request.params[0].get_int(); | CFeeRate feeRate = g_mempool.estimateFee(); | ||||
if (nBlocks < 1) { | |||||
nBlocks = 1; | |||||
} | |||||
CFeeRate feeRate = g_mempool.estimateFee(nBlocks); | |||||
if (feeRate == CFeeRate(Amount::zero())) { | if (feeRate == CFeeRate(Amount::zero())) { | ||||
return -1.0; | return -1.0; | ||||
} | } | ||||
return ValueFromAmount(feeRate.GetFeePerK()); | return ValueFromAmount(feeRate.GetFeePerK()); | ||||
} | } | ||||
// clang-format off | // clang-format off | ||||
Show All 19 Lines |