mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
option_will_fund: print out lease rates in listnodes
Note that we use the names from the spec. Changelog-Experimental: JSON-RPC: `listnodes` now includes the `lease_rates`, if available
This commit is contained in:
parent
876ff6821e
commit
f668e72dd6
@ -13,6 +13,7 @@
|
||||
#include <common/wireaddr.h>
|
||||
#include <errno.h>
|
||||
#include <wally_psbt.h>
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
bool json_to_bitcoin_amount(const char *buffer, const jsmntok_t *tok,
|
||||
uint64_t *satoshi)
|
||||
@ -369,3 +370,16 @@ void json_add_preimage(struct json_stream *result, const char *fieldname,
|
||||
json_add_hex(result, fieldname, preimage, sizeof(*preimage));
|
||||
}
|
||||
|
||||
void json_add_lease_rates(struct json_stream *result,
|
||||
const struct lease_rates *rates)
|
||||
{
|
||||
json_add_amount_sat_only(result, "lease_fee_base_msat",
|
||||
amount_sat(rates->lease_fee_base_sat));
|
||||
json_add_num(result, "lease_fee_basis", rates->lease_fee_basis);
|
||||
json_add_num(result, "funding_weight", rates->funding_weight);
|
||||
json_add_amount_msat_only(result,
|
||||
"channel_fee_max_base_msat",
|
||||
amount_msat(rates->channel_fee_max_base_msat));
|
||||
json_add_num(result, "channel_fee_max_proportional_thousandths",
|
||||
rates->channel_fee_max_proportional_thousandths);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ struct amount_msat;
|
||||
struct amount_sat;
|
||||
struct bip340sig;
|
||||
struct channel_id;
|
||||
struct lease_rates;
|
||||
struct node_id;
|
||||
struct preimage;
|
||||
struct pubkey;
|
||||
@ -179,4 +180,8 @@ void json_add_psbt(struct json_stream *stream,
|
||||
const char *fieldname,
|
||||
const struct wally_psbt *psbt);
|
||||
|
||||
/* Add fields from the lease_rates to a json stream.
|
||||
* Note that field names are set */
|
||||
void json_add_lease_rates(struct json_stream *result,
|
||||
const struct lease_rates *rates);
|
||||
#endif /* LIGHTNING_COMMON_JSON_HELPERS_H */
|
||||
|
@ -557,6 +557,12 @@ static void json_add_node(struct json_stream *js,
|
||||
for (size_t i = 0; i < tal_count(addrs); i++)
|
||||
json_add_address(js, NULL, &addrs[i]);
|
||||
json_array_end(js);
|
||||
|
||||
if (na_tlvs->option_will_fund) {
|
||||
json_object_start(js, "option_will_fund");
|
||||
json_add_lease_rates(js, na_tlvs->option_will_fund);
|
||||
json_object_end(js);
|
||||
}
|
||||
}
|
||||
out:
|
||||
json_object_end(js);
|
||||
|
Loading…
Reference in New Issue
Block a user