From 4be7e94e0b90dadcf1d8ccedbf600fda16cda20e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 1 Sep 2017 13:48:54 +0930 Subject: [PATCH] gossip: make rpc responses correct. It's not fee_per_kw, it's fee-per-millionth and a base in msatoshi. Signed-off-by: Rusty Russell --- gossipd/gossip.c | 3 ++- lightningd/gossip_control.c | 5 ++++- lightningd/gossip_msg.c | 6 ++++-- lightningd/gossip_msg.h | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gossipd/gossip.c b/gossipd/gossip.c index 229ef292b..75e80e5bc 100644 --- a/gossipd/gossip.c +++ b/gossipd/gossip.c @@ -573,7 +573,8 @@ static struct io_plan *getchannels_req(struct io_conn *conn, struct daemon *daem entries[num_chans].short_channel_id = n->out[j]->short_channel_id; entries[num_chans].last_update_timestamp = n->out[j]->last_timestamp; if (entries[num_chans].last_update_timestamp >= 0) { - entries[num_chans].fee_per_kw = n->out[j]->proportional_fee; + entries[num_chans].base_fee_msat = n->out[j]->base_fee; + entries[num_chans].fee_per_millionth = n->out[j]->proportional_fee; entries[num_chans].delay = n->out[j]->delay; } num_chans++; diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 89badba47..b72036eb8 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -310,7 +310,10 @@ static bool json_getchannels_reply(struct subd *gossip, const u8 *reply, if (entries[i].last_update_timestamp >= 0) { json_add_num(response, "last_update", entries[i].last_update_timestamp); - json_add_num(response, "fee_per_kw", entries[i].fee_per_kw); + json_add_num(response, "base_fee_millisatoshi", + entries[i].base_fee_msat); + json_add_num(response, "fee_per_millionth", + entries[i].fee_per_millionth); json_add_num(response, "delay", entries[i].delay); } json_object_end(response); diff --git a/lightningd/gossip_msg.c b/lightningd/gossip_msg.c index cf1efcdff..eb5307a3b 100644 --- a/lightningd/gossip_msg.c +++ b/lightningd/gossip_msg.c @@ -48,7 +48,8 @@ void fromwire_gossip_getchannels_entry(const u8 **pptr, size_t *max, entry->flags = fromwire_u16(pptr, max); entry->last_update_timestamp = fromwire_u64(pptr, max); if (entry->last_update_timestamp >= 0) { - entry->fee_per_kw = fromwire_u32(pptr, max); + entry->base_fee_msat = fromwire_u32(pptr, max); + entry->fee_per_millionth = fromwire_u32(pptr, max); entry->delay = fromwire_u32(pptr, max); } } @@ -63,7 +64,8 @@ void towire_gossip_getchannels_entry( towire_u16(pptr, entry->flags); towire_u64(pptr, entry->last_update_timestamp); if (entry->last_update_timestamp >= 0) { - towire_u32(pptr, entry->fee_per_kw); + towire_u32(pptr, entry->base_fee_msat); + towire_u32(pptr, entry->fee_per_millionth); towire_u32(pptr, entry->delay); } } diff --git a/lightningd/gossip_msg.h b/lightningd/gossip_msg.h index ea32c1e75..652303423 100644 --- a/lightningd/gossip_msg.h +++ b/lightningd/gossip_msg.h @@ -17,7 +17,8 @@ struct gossip_getchannels_entry { s64 last_update_timestamp; /* -1 means never */ /* These are only set if last_update_timestamp >= 0 */ u32 delay; - u32 fee_per_kw; + u32 base_fee_msat; + u32 fee_per_millionth; }; void fromwire_gossip_getnodes_entry(const tal_t *ctx, const u8 **pptr,