mirror of
https://github.com/monero-project/monero.git
synced 2025-08-16 12:00:18 -04:00
Merge pull request #9958
9002681
Add new dynamic fees to ZMQ (Lee Clagett)
This commit is contained in:
commit
3e218c2021
3 changed files with 9 additions and 1 deletions
|
@ -843,15 +843,20 @@ namespace rpc
|
|||
void DaemonHandler::handle(const GetFeeEstimate::Request& req, GetFeeEstimate::Response& res)
|
||||
{
|
||||
res.hard_fork_version = m_core.get_blockchain_storage().get_current_hard_fork_version();
|
||||
res.estimated_base_fee = m_core.get_blockchain_storage().get_dynamic_base_fee_estimate(req.num_grace_blocks);
|
||||
|
||||
|
||||
if (res.hard_fork_version < HF_VERSION_PER_BYTE_FEE)
|
||||
{
|
||||
res.fees.clear();
|
||||
res.estimated_base_fee = m_core.get_blockchain_storage().get_dynamic_base_fee_estimate(req.num_grace_blocks);
|
||||
res.size_scale = 1024; // per KiB fee
|
||||
res.fee_mask = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_core.get_blockchain_storage().get_dynamic_base_fee_estimate_2021_scaling(req.num_grace_blocks, res.fees);
|
||||
res.estimated_base_fee = res.fees.at(0);
|
||||
|
||||
res.size_scale = 1; // per byte fee
|
||||
res.fee_mask = Blockchain::get_fee_quantization_mask();
|
||||
}
|
||||
|
|
|
@ -753,6 +753,7 @@ void GetFeeEstimate::Request::fromJson(const rapidjson::Value& val)
|
|||
|
||||
void GetFeeEstimate::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest) const
|
||||
{
|
||||
INSERT_INTO_JSON_OBJECT(dest, fees, fees);
|
||||
INSERT_INTO_JSON_OBJECT(dest, estimated_base_fee, estimated_base_fee);
|
||||
INSERT_INTO_JSON_OBJECT(dest, fee_mask, fee_mask);
|
||||
INSERT_INTO_JSON_OBJECT(dest, size_scale, size_scale);
|
||||
|
@ -766,6 +767,7 @@ void GetFeeEstimate::Response::fromJson(const rapidjson::Value& val)
|
|||
throw json::WRONG_TYPE("json object");
|
||||
}
|
||||
|
||||
GET_FROM_JSON_OBJECT(val, fees, fees);
|
||||
GET_FROM_JSON_OBJECT(val, estimated_base_fee, estimated_base_fee);
|
||||
GET_FROM_JSON_OBJECT(val, fee_mask, fee_mask);
|
||||
GET_FROM_JSON_OBJECT(val, size_scale, size_scale);
|
||||
|
|
|
@ -423,6 +423,7 @@ BEGIN_RPC_MESSAGE_CLASS(GetFeeEstimate);
|
|||
RPC_MESSAGE_MEMBER(uint64_t, num_grace_blocks);
|
||||
END_RPC_MESSAGE_REQUEST;
|
||||
BEGIN_RPC_MESSAGE_RESPONSE;
|
||||
RPC_MESSAGE_MEMBER(std::vector<uint64_t>, fees);
|
||||
RPC_MESSAGE_MEMBER(uint64_t, estimated_base_fee);
|
||||
RPC_MESSAGE_MEMBER(uint64_t, fee_mask);
|
||||
RPC_MESSAGE_MEMBER(uint32_t, size_scale);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue