Skip to content

Commit

Permalink
listpeerchannels: show gossip updates.
Browse files Browse the repository at this point in the history
This is redundant if it's a public channel, but vital if it's not.  Publishing unconditionally makes
it easier for gossmap: we create a local modification all the time, even if redundant (and we can
have the actual capacity ceiling accurate in this case, since we know it for local channels).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Changelog-Added: JSON-RPC: `listpeerchannels` now shows gossip update contents (even if channel unannounced).
  • Loading branch information
rustyrussell committed Dec 13, 2023
1 parent 5583f73 commit c3f33eb
Show file tree
Hide file tree
Showing 12 changed files with 555 additions and 185 deletions.
73 changes: 72 additions & 1 deletion .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,8 @@
"ListPeerChannels.channels[].their_reserve_msat": 31,
"ListPeerChannels.channels[].their_to_self_delay": 38,
"ListPeerChannels.channels[].to_us_msat": 23,
"ListPeerChannels.channels[].total_msat": 26
"ListPeerChannels.channels[].total_msat": 26,
"ListPeerChannels.channels[].updates": 55
},
"ListpeerchannelsChannelsAlias": {
"ListPeerChannels.channels[].alias.local": 1,
Expand Down Expand Up @@ -1218,6 +1219,24 @@
"ListPeerChannels.channels[].state_changes[].old_state": 2,
"ListPeerChannels.channels[].state_changes[].timestamp": 1
},
"ListpeerchannelsChannelsUpdates": {
"ListPeerChannels.channels[].updates.local": 1,
"ListPeerChannels.channels[].updates.remote": 2
},
"ListpeerchannelsChannelsUpdatesLocal": {
"ListPeerChannels.channels[].updates.local.cltv_expiry_delta": 3,
"ListPeerChannels.channels[].updates.local.fee_base_msat": 4,
"ListPeerChannels.channels[].updates.local.fee_proportional_millionths": 5,
"ListPeerChannels.channels[].updates.local.htlc_maximum_msat": 2,
"ListPeerChannels.channels[].updates.local.htlc_minimum_msat": 1
},
"ListpeerchannelsChannelsUpdatesRemote": {
"ListPeerChannels.channels[].updates.remote.cltv_expiry_delta": 3,
"ListPeerChannels.channels[].updates.remote.fee_base_msat": 4,
"ListPeerChannels.channels[].updates.remote.fee_proportional_millionths": 5,
"ListPeerChannels.channels[].updates.remote.htlc_maximum_msat": 2,
"ListPeerChannels.channels[].updates.remote.htlc_minimum_msat": 1
},
"ListpeerchannelsRequest": {
"ListPeerChannels.id": 1
},
Expand Down Expand Up @@ -4511,6 +4530,58 @@
"added": "v23.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.local": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.local.cltv_expiry_delta": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.local.fee_base_msat": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.local.fee_proportional_millionths": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.local.htlc_maximum_msat": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.local.htlc_minimum_msat": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.remote": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.remote.cltv_expiry_delta": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.remote.fee_base_msat": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.remote.fee_proportional_millionths": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.remote.htlc_maximum_msat": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].updates.remote.htlc_minimum_msat": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.id": {
"added": "v23.02",
"deprecated": false
Expand Down
22 changes: 22 additions & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contrib/msggen/msggen/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class OptionalPatch(Patch):
'v23.05',
'v23.08',
'v23.11',
'v24.02',
]
# Oldest supported versions. Bump this if you no longer want to
# support older versions, and you want to make required fields
Expand Down
370 changes: 188 additions & 182 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,31 @@ def listpeerchannels_channels_channel_type2py(m):
})


def listpeerchannels_channels_updates_local2py(m):
return remove_default({
"htlc_minimum_msat": amount2msat(m.htlc_minimum_msat), # PrimitiveField in generate_composite
"htlc_maximum_msat": amount2msat(m.htlc_maximum_msat), # PrimitiveField in generate_composite
"cltv_expiry_delta": m.cltv_expiry_delta, # PrimitiveField in generate_composite
"fee_base_msat": amount2msat(m.fee_base_msat), # PrimitiveField in generate_composite
"fee_proportional_millionths": m.fee_proportional_millionths, # PrimitiveField in generate_composite
})


def listpeerchannels_channels_updates_remote2py(m):
return remove_default({
"htlc_minimum_msat": amount2msat(m.htlc_minimum_msat), # PrimitiveField in generate_composite
"htlc_maximum_msat": amount2msat(m.htlc_maximum_msat), # PrimitiveField in generate_composite
"cltv_expiry_delta": m.cltv_expiry_delta, # PrimitiveField in generate_composite
"fee_base_msat": amount2msat(m.fee_base_msat), # PrimitiveField in generate_composite
"fee_proportional_millionths": m.fee_proportional_millionths, # PrimitiveField in generate_composite
})


def listpeerchannels_channels_updates2py(m):
return remove_default({
})


def listpeerchannels_channels_feerate2py(m):
return remove_default({
"perkw": m.perkw, # PrimitiveField in generate_composite
Expand Down
15 changes: 14 additions & 1 deletion doc/lightning-listpeerchannels.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ On success, an object containing **channels** is returned. It is an array of ob
- Bit number
- **names** (array of strings): Feature name for each bit set in this channel\_type:
- Name of feature bit (one of "static\_remotekey/even", "anchor\_outputs/even", "anchors\_zero\_fee\_htlc\_tx/even", "scid\_alias/even", "zeroconf/even")
- **updates** (object, optional): Latest gossip updates sent/received *(added v24.02)*:
- **local** (object): Our gossip for channel *(added v24.02)*:
- **htlc\_minimum\_msat** (msat): Minimum msat amount we allow *(added v24.02)*
- **htlc\_maximum\_msat** (msat): Maximum msat amount we allow *(added v24.02)*
- **cltv\_expiry\_delta** (u32): Blocks delay required between incoming and outgoing HTLCs *(added v24.02)*
- **fee\_base\_msat** (msat): Amount we charge to use the channel *(added v24.02)*
- **fee\_proportional\_millionths** (u32): Amount we charge to use the channel in parts-per-million *(added v24.02)*
- **remote** (object, optional): Peer's gossip for channel *(added v24.02)*:
- **htlc\_minimum\_msat** (msat): Minimum msat amount they allow *(added v24.02)*
- **htlc\_maximum\_msat** (msat): Maximum msat amount they allow *(added v24.02)*
- **cltv\_expiry\_delta** (u32): Blocks delay required between incoming and outgoing HTLCs *(added v24.02)*
- **fee\_base\_msat** (msat): Amount they charge to use the channel *(added v24.02)*
- **fee\_proportional\_millionths** (u32): Amount they charge to use the channel in parts-per-million *(added v24.02)*
- **ignore\_fee\_limits** (boolean, optional): set if we allow this peer to set fees to anything they want *(added v23.08)*
- **feerate** (object, optional): Feerates for the current tx:
- **perkw** (u32): Feerate per 1000 weight (i.e kSipa)
Expand Down Expand Up @@ -202,4 +215,4 @@ Main web site: <https://github.com/ElementsProject/lightning> Lightning
RFC site (BOLT \#9):
<https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md>

[comment]: # ( SHA256STAMP:c4507febb0d592ac386f2e8bedbc88ab77d93f780e2d534d6c8d8064afbd6ee6)
[comment]: # ( SHA256STAMP:fac5201293041a7875d78c0f7acc0067ba34d5ad4b809307ea334afde7563aaf)
12 changes: 11 additions & 1 deletion doc/lightning-sql.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,16 @@ The following tables are currently supported:
- `row` (reference to `peerchannels_channel_type.rowid`, sqltype `INTEGER`)
- `arrindex` (index within array, sqltype `INTEGER`)
- `names` (type `string`, sqltype `TEXT`)
- `local_htlc_minimum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `local`)
- `local_htlc_maximum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `local`)
- `local_cltv_expiry_delta` (type `u32`, sqltype `INTEGER`, from JSON object `local`)
- `local_fee_base_msat` (type `msat`, sqltype `INTEGER`, from JSON object `local`)
- `local_fee_proportional_millionths` (type `u32`, sqltype `INTEGER`, from JSON object `local`)
- `remote_htlc_minimum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `remote`)
- `remote_htlc_maximum_msat` (type `msat`, sqltype `INTEGER`, from JSON object `remote`)
- `remote_cltv_expiry_delta` (type `u32`, sqltype `INTEGER`, from JSON object `remote`)
- `remote_fee_base_msat` (type `msat`, sqltype `INTEGER`, from JSON object `remote`)
- `remote_fee_proportional_millionths` (type `u32`, sqltype `INTEGER`, from JSON object `remote`)
- `ignore_fee_limits` (type `boolean`, sqltype `INTEGER`)
- `feerate_perkw` (type `u32`, sqltype `INTEGER`, from JSON object `feerate`)
- `feerate_perkb` (type `u32`, sqltype `INTEGER`, from JSON object `feerate`)
Expand Down Expand Up @@ -520,4 +530,4 @@ RESOURCES
---------

Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:f1434805992a6d428e96c93e2acde932d99da9cfbc91c9b543b3553b1af39c9b)
[comment]: # ( SHA256STAMP:5c5e14f8fde75b877080c0c10feb786f1d2fefbb61a62aecb8d003d1d54627e9)
Loading

0 comments on commit c3f33eb

Please sign in to comment.