mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
fix 'listincoming' field incoming_capacity_msat.
incoming_capacity_msat field showed the value as microsat. Changelog-Fixed: JSON-RPC: listincoming showed incoming_capacity_msat field 1000 times actual value.
This commit is contained in:
committed by
Rusty Russell
parent
fe9f426e07
commit
522ee5c595
@@ -558,12 +558,12 @@ static struct command_result *json_listnodes(struct command *cmd,
|
||||
}
|
||||
|
||||
/* What is capacity of peer attached to chan #n? */
|
||||
static struct amount_sat peer_capacity(const struct gossmap *gossmap,
|
||||
static struct amount_msat peer_capacity(const struct gossmap *gossmap,
|
||||
const struct gossmap_node *me,
|
||||
const struct gossmap_node *peer,
|
||||
const struct gossmap_chan *ourchan)
|
||||
{
|
||||
struct amount_sat capacity = AMOUNT_SAT(0);
|
||||
struct amount_msat capacity = AMOUNT_MSAT(0);
|
||||
|
||||
for (size_t i = 0; i < peer->num_chans; i++) {
|
||||
int dir;
|
||||
@@ -573,8 +573,8 @@ static struct amount_sat peer_capacity(const struct gossmap *gossmap,
|
||||
continue;
|
||||
if (!c->half[!dir].enabled)
|
||||
continue;
|
||||
if (!amount_sat_add(&capacity, capacity,
|
||||
amount_sat(fp16_to_u64(c->half[dir]
|
||||
if (!amount_msat_add(&capacity, capacity,
|
||||
amount_msat(fp16_to_u64(c->half[dir]
|
||||
.htlc_max))))
|
||||
continue;
|
||||
}
|
||||
@@ -625,7 +625,7 @@ static struct command_result *json_listincoming(struct command *cmd,
|
||||
json_add_u32(js, "fee_proportional_millionths",
|
||||
ourchan->half[!dir].proportional_fee);
|
||||
json_add_u32(js, "cltv_expiry_delta", ourchan->half[!dir].delay);
|
||||
json_add_amount_sat_only(js, "incoming_capacity_msat",
|
||||
json_add_amount_msat_only(js, "incoming_capacity_msat",
|
||||
peer_capacity(gossmap,
|
||||
me, peer, ourchan));
|
||||
json_object_end(js);
|
||||
|
||||
Reference in New Issue
Block a user