mirror of
https://github.com/vtnerd/monero-lws.git
synced 2024-11-16 17:27:39 +00:00
keep old usage of per_kb_fee functional
This commit is contained in:
parent
f027c15479
commit
04c6d553c6
3 changed files with 9 additions and 8 deletions
|
@ -537,15 +537,15 @@ namespace lws
|
|||
if (!resp)
|
||||
return resp.error();
|
||||
|
||||
if (resp->size_scale == 0 || 1024 < resp->size_scale || resp->fee_mask == 0)
|
||||
if ((resp->size_scale != 1 && resp->size_scale != 1024) || resp->fee_mask == 0)
|
||||
return {lws::error::bad_daemon_response};
|
||||
|
||||
const std::uint64_t per_byte_fee =
|
||||
resp->estimated_base_fee / resp->size_scale;
|
||||
const std::uint64_t per_byte_fee_masked =
|
||||
((per_byte_fee + (resp->fee_mask - 1)) / resp->fee_mask) * resp->fee_mask;
|
||||
const bool use_per_byte_fee = resp->size_scale == 1;
|
||||
const std::uint64_t base_fee = resp->estimated_base_fee;
|
||||
const std::uint64_t base_fee_masked =
|
||||
((base_fee + (resp->fee_mask - 1)) / resp->fee_mask) * resp->fee_mask;
|
||||
|
||||
return response{per_byte_fee_masked, resp->fee_mask, rpc::safe_uint64(received), std::move(unspent), std::move(req.creds.key)};
|
||||
return response{base_fee_masked, resp->fee_mask, rpc::safe_uint64(received), std::move(unspent), std::move(req.creds.key), use_per_byte_fee};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ namespace lws
|
|||
return expand_outputs{src, self.user_key};
|
||||
};
|
||||
wire::object(dest,
|
||||
WIRE_FIELD_COPY(per_byte_fee),
|
||||
wire::field(self.use_per_byte_fee ? "per_byte_fee" : "per_kb_fee", self.base_fee),
|
||||
WIRE_FIELD_COPY(fee_mask),
|
||||
WIRE_FIELD_COPY(amount),
|
||||
wire::field("outputs", wire::as_array(std::cref(self.outputs), expand))
|
||||
|
|
|
@ -155,11 +155,12 @@ namespace rpc
|
|||
struct get_unspent_outs_response
|
||||
{
|
||||
get_unspent_outs_response() = delete;
|
||||
std::uint64_t per_byte_fee;
|
||||
std::uint64_t base_fee; // either per_byte_fee or per_kb_fee
|
||||
std::uint64_t fee_mask;
|
||||
safe_uint64 amount;
|
||||
std::vector<std::pair<db::output, std::vector<crypto::key_image>>> outputs;
|
||||
crypto::secret_key user_key;
|
||||
bool use_per_byte_fee;
|
||||
};
|
||||
void write_bytes(wire::json_writer&, const get_unspent_outs_response&);
|
||||
|
||||
|
|
Loading…
Reference in a new issue