diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ce3ef58..393128ae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - JSON API: `listpeers` status now shows how many confirmations until channel is open (#2405) - Config: Adds parameter `min-capacity-sat` to reject tiny channels. - JSON API: `listforwards` now includes the time an HTLC was received and when it was resolved. Both are expressed as UNIX timestamps to facilitate parsing (Issue [#2491](https://github.com/ElementsProject/lightning/issues/2491), PR [#2528](https://github.com/ElementsProject/lightning/pull/2528)) -+- JSON API: new plugin hooks `invoice_payment` for intercepting invoices before they're paid, `openchannel` for intercepting channel opens, and `htlc_accepted` to decide whether to resolve, reject or continue an incoming or forwarded payment.. +- JSON API: new plugin hooks `invoice_payment` for intercepting invoices before they're paid, `openchannel` for intercepting channel opens, and `htlc_accepted` to decide whether to resolve, reject or continue an incoming or forwarded payment.. - plugin: the `connected` hook can now send an `error_message` to the rejected peer. - Protocol: we now enforce `option_upfront_shutdown_script` if a peer negotiates it. - JSON API: `listforwards` now includes the local_failed forwards with failcode (Issue [#2435](https://github.com/ElementsProject/lightning/issues/2435), PR [#2524](https://github.com/ElementsProject/lightning/pull/2524)) @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 (Issue [#2409](https://github.com/ElementsProject/lightning/issues/2409)) - JSON API: new withdraw methods `txprepare`, `txsend` and `txdiscard`. - plugin: the `warning` notification can now detect any `LOG_UNUSUAL`/`LOG_BROKEN` level event. +- JSON API: `listchannels` has new fields `htlc_minimum_msat` and `htlc_maximum_msat`. ### Changed diff --git a/doc/lightning-listchannels.7 b/doc/lightning-listchannels.7 index 05d631c63..a39e24d1d 100644 --- a/doc/lightning-listchannels.7 +++ b/doc/lightning-listchannels.7 @@ -2,12 +2,12 @@ .\" Title: lightning-listchannels .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 02/18/2019 +.\" Date: 05/31/2019 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "LIGHTNING\-LISTCHANN" "7" "02/18/2019" "\ \&" "\ \&" +.TH "LIGHTNING\-LISTCHANN" "7" "05/31/2019" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -206,6 +206,30 @@ message (BOLT #7)\&. : The number of blocks delay required to wait for on\-chain settlement when unilaterally closing the channel (BOLT #2)\&. .RE .sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +\fIhtlc_minimum_msat\fR +: The minimum payment which can be send through this channel\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} +\fIhtlc_maximum_msat\fR +: The maximum payment which can be send through this channel\&. +.RE +.sp If \fIshort_channel_id\fR or \fIsource\fR is supplied and no matching channels are found, a "channels" object with an empty list is returned\&. .SH "ERRORS" .sp diff --git a/doc/lightning-listchannels.7.txt b/doc/lightning-listchannels.7.txt index 648edcb38..7ebac38d5 100644 --- a/doc/lightning-listchannels.7.txt +++ b/doc/lightning-listchannels.7.txt @@ -59,6 +59,8 @@ HTLC (BOLT #2). transferred satoshi (BOLT #2). - 'delay' : The number of blocks delay required to wait for on-chain settlement when unilaterally closing the channel (BOLT #2). +- 'htlc_minimum_msat' : The minimum payment which can be send through this channel. +- 'htlc_maximum_msat' : The maximum payment which can be send through this channel. If 'short_channel_id' or 'source' is supplied and no matching channels are found, a "channels" object with an empty list is returned. diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 3d126f1d2..6503c8614 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -1948,6 +1948,8 @@ static struct gossip_halfchannel_entry *hc_entry(const tal_t *ctx, e->base_fee_msat = c->base_fee; e->fee_per_millionth = c->proportional_fee; e->delay = c->delay; + e->min = c->htlc_minimum; + e->max = c->htlc_maximum; return e; } diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 06ac60910..d0380a2d0 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -389,6 +389,8 @@ static void json_add_halfchan(struct json_stream *response, json_add_num(response, "base_fee_millisatoshi", he->base_fee_msat); json_add_num(response, "fee_per_millionth", he->fee_per_millionth); json_add_num(response, "delay", he->delay); + json_add_amount_msat_only(response, "htlc_minimum_msat", he->min); + json_add_amount_msat_only(response, "htlc_maximum_msat", he->max); json_object_end(response); } diff --git a/lightningd/gossip_msg.c b/lightningd/gossip_msg.c index 7150ef9dd..afd065416 100644 --- a/lightningd/gossip_msg.c +++ b/lightningd/gossip_msg.c @@ -105,6 +105,8 @@ static void fromwire_gossip_halfchannel_entry(const u8 **pptr, size_t *max, entry->delay = fromwire_u32(pptr, max); entry->base_fee_msat = fromwire_u32(pptr, max); entry->fee_per_millionth = fromwire_u32(pptr, max); + entry->min = fromwire_amount_msat(pptr, max); + entry->max = fromwire_amount_msat(pptr, max); } struct gossip_getchannels_entry * @@ -144,6 +146,8 @@ static void towire_gossip_halfchannel_entry(u8 **pptr, towire_u32(pptr, entry->delay); towire_u32(pptr, entry->base_fee_msat); towire_u32(pptr, entry->fee_per_millionth); + towire_amount_msat(pptr, entry->min); + towire_amount_msat(pptr, entry->max); } void towire_gossip_getchannels_entry(u8 **pptr, diff --git a/lightningd/gossip_msg.h b/lightningd/gossip_msg.h index 26ab7c898..de6b38782 100644 --- a/lightningd/gossip_msg.h +++ b/lightningd/gossip_msg.h @@ -27,6 +27,7 @@ struct gossip_halfchannel_entry { u32 delay; u32 base_fee_msat; u32 fee_per_millionth; + struct amount_msat min, max; }; struct gossip_getchannels_entry {