mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
Call estimate(Smart)Fee directly from CBlockPolicyEstimator
This commit is contained in:
parent
dbb9e3699b
commit
14e10aa842
12 changed files with 49 additions and 60 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include "validation.h"
|
||||
#include "miner.h"
|
||||
#include "net.h"
|
||||
#include "policy/fees.h"
|
||||
#include "pow.h"
|
||||
#include "rpc/blockchain.h"
|
||||
#include "rpc/server.h"
|
||||
|
|
@ -819,7 +820,7 @@ UniValue estimatefee(const JSONRPCRequest& request)
|
|||
if (nBlocks < 1)
|
||||
nBlocks = 1;
|
||||
|
||||
CFeeRate feeRate = mempool.estimateFee(nBlocks);
|
||||
CFeeRate feeRate = ::feeEstimator.estimateFee(nBlocks);
|
||||
if (feeRate == CFeeRate(0))
|
||||
return -1.0;
|
||||
|
||||
|
|
@ -857,7 +858,7 @@ UniValue estimatesmartfee(const JSONRPCRequest& request)
|
|||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
int answerFound;
|
||||
CFeeRate feeRate = mempool.estimateSmartFee(nBlocks, &answerFound);
|
||||
CFeeRate feeRate = ::feeEstimator.estimateSmartFee(nBlocks, &answerFound, ::mempool);
|
||||
result.push_back(Pair("feerate", feeRate == CFeeRate(0) ? -1.0 : ValueFromAmount(feeRate.GetFeePerK())));
|
||||
result.push_back(Pair("blocks", answerFound));
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue