Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 3) { | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") + | HelpExampleCli("prioritisetransaction", "\"txid\" 0.0 10000") + | ||||
HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")); | HelpExampleRpc("prioritisetransaction", "\"txid\", 0.0, 10000")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
uint256 hash = ParseHashStr(request.params[0].get_str(), "txid"); | uint256 hash = ParseHashStr(request.params[0].get_str(), "txid"); | ||||
Amount nAmount = request.params[2].get_int64(); | Amount nAmount(request.params[2].get_int64()); | ||||
mempool.PrioritiseTransaction(hash, request.params[0].get_str(), | mempool.PrioritiseTransaction(hash, request.params[0].get_str(), | ||||
request.params[1].get_real(), nAmount); | request.params[1].get_real(), nAmount); | ||||
return true; | return true; | ||||
} | } | ||||
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be | // NOTE: Assumes a conclusive result; if result is inconclusive, it must be | ||||
// handled by caller | // handled by caller | ||||
▲ Show 20 Lines • Show All 600 Lines • ▼ Show 20 Lines | static UniValue estimatefee(const Config &config, | ||||
RPCTypeCheck(request.params, {UniValue::VNUM}); | RPCTypeCheck(request.params, {UniValue::VNUM}); | ||||
int nBlocks = request.params[0].get_int(); | int nBlocks = request.params[0].get_int(); | ||||
if (nBlocks < 1) { | if (nBlocks < 1) { | ||||
nBlocks = 1; | nBlocks = 1; | ||||
} | } | ||||
CFeeRate feeRate = mempool.estimateFee(nBlocks); | CFeeRate feeRate = mempool.estimateFee(nBlocks); | ||||
if (feeRate == CFeeRate(0)) { | if (feeRate == CFeeRate(Amount(0))) { | ||||
return -1.0; | return -1.0; | ||||
} | } | ||||
return ValueFromAmount(feeRate.GetFeePerK()); | return ValueFromAmount(feeRate.GetFeePerK()); | ||||
} | } | ||||
static UniValue estimatepriority(const Config &config, | static UniValue estimatepriority(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static UniValue estimatesmartfee(const Config &config, | ||||
RPCTypeCheck(request.params, {UniValue::VNUM}); | RPCTypeCheck(request.params, {UniValue::VNUM}); | ||||
int nBlocks = request.params[0].get_int(); | int nBlocks = request.params[0].get_int(); | ||||
UniValue result(UniValue::VOBJ); | UniValue result(UniValue::VOBJ); | ||||
int answerFound; | int answerFound; | ||||
CFeeRate feeRate = mempool.estimateSmartFee(nBlocks, &answerFound); | CFeeRate feeRate = mempool.estimateSmartFee(nBlocks, &answerFound); | ||||
result.push_back(Pair( | result.push_back( | ||||
"feerate", | Pair("feerate", feeRate == CFeeRate(Amount(0)) | ||||
feeRate == CFeeRate(0) ? -1.0 : ValueFromAmount(feeRate.GetFeePerK()))); | ? -1.0 | ||||
: ValueFromAmount(feeRate.GetFeePerK()))); | |||||
result.push_back(Pair("blocks", answerFound)); | result.push_back(Pair("blocks", answerFound)); | ||||
return result; | return result; | ||||
} | } | ||||
static UniValue estimatesmartpriority(const Config &config, | static UniValue estimatesmartpriority(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |