Skip to content

Commit 3e218c2

Browse files
committed
Merge pull request #9958
9002681 Add new dynamic fees to ZMQ (Lee Clagett)
2 parents 0b739fd + 9002681 commit 3e218c2

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/rpc/daemon_handler.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,15 +843,20 @@ namespace rpc
843843
void DaemonHandler::handle(const GetFeeEstimate::Request& req, GetFeeEstimate::Response& res)
844844
{
845845
res.hard_fork_version = m_core.get_blockchain_storage().get_current_hard_fork_version();
846-
res.estimated_base_fee = m_core.get_blockchain_storage().get_dynamic_base_fee_estimate(req.num_grace_blocks);
846+
847847

848848
if (res.hard_fork_version < HF_VERSION_PER_BYTE_FEE)
849849
{
850+
res.fees.clear();
851+
res.estimated_base_fee = m_core.get_blockchain_storage().get_dynamic_base_fee_estimate(req.num_grace_blocks);
850852
res.size_scale = 1024; // per KiB fee
851853
res.fee_mask = 1;
852854
}
853855
else
854856
{
857+
m_core.get_blockchain_storage().get_dynamic_base_fee_estimate_2021_scaling(req.num_grace_blocks, res.fees);
858+
res.estimated_base_fee = res.fees.at(0);
859+
855860
res.size_scale = 1; // per byte fee
856861
res.fee_mask = Blockchain::get_fee_quantization_mask();
857862
}

src/rpc/daemon_messages.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ void GetFeeEstimate::Request::fromJson(const rapidjson::Value& val)
753753

754754
void GetFeeEstimate::Response::doToJson(rapidjson::Writer<epee::byte_stream>& dest) const
755755
{
756+
INSERT_INTO_JSON_OBJECT(dest, fees, fees);
756757
INSERT_INTO_JSON_OBJECT(dest, estimated_base_fee, estimated_base_fee);
757758
INSERT_INTO_JSON_OBJECT(dest, fee_mask, fee_mask);
758759
INSERT_INTO_JSON_OBJECT(dest, size_scale, size_scale);
@@ -766,6 +767,7 @@ void GetFeeEstimate::Response::fromJson(const rapidjson::Value& val)
766767
throw json::WRONG_TYPE("json object");
767768
}
768769

770+
GET_FROM_JSON_OBJECT(val, fees, fees);
769771
GET_FROM_JSON_OBJECT(val, estimated_base_fee, estimated_base_fee);
770772
GET_FROM_JSON_OBJECT(val, fee_mask, fee_mask);
771773
GET_FROM_JSON_OBJECT(val, size_scale, size_scale);

src/rpc/daemon_messages.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ BEGIN_RPC_MESSAGE_CLASS(GetFeeEstimate);
423423
RPC_MESSAGE_MEMBER(uint64_t, num_grace_blocks);
424424
END_RPC_MESSAGE_REQUEST;
425425
BEGIN_RPC_MESSAGE_RESPONSE;
426+
RPC_MESSAGE_MEMBER(std::vector<uint64_t>, fees);
426427
RPC_MESSAGE_MEMBER(uint64_t, estimated_base_fee);
427428
RPC_MESSAGE_MEMBER(uint64_t, fee_mask);
428429
RPC_MESSAGE_MEMBER(uint32_t, size_scale);

0 commit comments

Comments
 (0)