Skip to content

Commit

Permalink
peer_control: Add lost_state param inside listpeerchannels rpc, which…
Browse files Browse the repository at this point in the history
…'d help us identify if we've fall behind or lost some state.
  • Loading branch information
adi2011 authored and cdecker committed Feb 16, 2024
1 parent 7827a26 commit 9acc1d7
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 208 deletions.
5 changes: 5 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,7 @@
"ListPeerChannels.channels[].initial_feerate": 12,
"ListPeerChannels.channels[].last_feerate": 13,
"ListPeerChannels.channels[].last_stable_connection": 56,
"ListPeerChannels.channels[].lost_state": 57,
"ListPeerChannels.channels[].max_accepted_htlcs": 40,
"ListPeerChannels.channels[].max_to_us_msat": 25,
"ListPeerChannels.channels[].max_total_htlc_in_msat": 30,
Expand Down Expand Up @@ -4589,6 +4590,10 @@
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].lost_state": {
"added": "v24.02",
"deprecated": false
},
"ListPeerChannels.channels[].max_accepted_htlcs": {
"added": "v23.02",
"deprecated": false
Expand Down
1 change: 1 addition & 0 deletions cln-grpc/proto/node.proto

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

1 change: 1 addition & 0 deletions cln-grpc/src/convert.rs

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

2 changes: 2 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.

9 changes: 9 additions & 0 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10596,6 +10596,11 @@
"added": "v23.08",
"description": "set if we allow this peer to set fees to anything they want"
},
"lost_state": {
"type": "boolean",
"added": "v24.02",
"description": "set if we are fallen behind i.e. lost some channel state."
},
"feerate": {
"type": "object",
"description": "Feerates for the current tx",
Expand Down Expand Up @@ -11161,6 +11166,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
Expand Down Expand Up @@ -11255,6 +11261,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
Expand Down Expand Up @@ -11348,6 +11355,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
Expand Down Expand Up @@ -11442,6 +11450,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"alias": {},
"short_channel_id": {},
Expand Down
412 changes: 206 additions & 206 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ def listpeerchannels_channels2py(m):
"state": str(m.state), # EnumField in generate_composite
"scratch_txid": hexlify(m.scratch_txid), # PrimitiveField in generate_composite
"ignore_fee_limits": m.ignore_fee_limits, # PrimitiveField in generate_composite
"lost_state": m.lost_state, # PrimitiveField in generate_composite
"owner": m.owner, # PrimitiveField in generate_composite
"short_channel_id": m.short_channel_id, # PrimitiveField in generate_composite
"channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite
Expand Down
3 changes: 2 additions & 1 deletion doc/lightning-listpeerchannels.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ On success, an object containing **channels** is returned. It is an array of ob
- **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)*
- **lost\_state** (boolean, optional): set if we are fallen behind i.e. lost some channel state. *(added v24.02)*
- **feerate** (object, optional): Feerates for the current tx:
- **perkw** (u32): Feerate per 1000 weight (i.e kSipa)
- **perkb** (u32): Feerate per 1000 virtual bytes
Expand Down Expand Up @@ -220,4 +221,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:c2ab91a2357b83264415f923b9d5195e5294a17b7424d9e75ac9ea704bea8fc5)
[comment]: # ( SHA256STAMP:02dbb15d46497d33808d1bc021cb604529546b94f46d8de285d7b47f4615a516)
3 changes: 2 additions & 1 deletion doc/lightning-sql.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ The following tables are currently supported:
- `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`)
- `lost_state` (type `boolean`, sqltype `INTEGER`)
- `feerate_perkw` (type `u32`, sqltype `INTEGER`, from JSON object `feerate`)
- `feerate_perkb` (type `u32`, sqltype `INTEGER`, from JSON object `feerate`)
- `owner` (type `string`, sqltype `TEXT`)
Expand Down Expand Up @@ -533,4 +534,4 @@ RESOURCES
---------

Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:299446e88b1f847a82ae63c2087ce28a36b7c8fea2b102d4e3d87c420a9268e9)
[comment]: # ( SHA256STAMP:24eeff191907cb804299716293ef0733ef25cf8e74eb1808749aebbfd9e9fa9f)
9 changes: 9 additions & 0 deletions doc/schemas/listpeerchannels.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@
"added": "v23.08",
"description": "set if we allow this peer to set fees to anything they want"
},
"lost_state": {
"type": "boolean",
"added": "v24.02",
"description": "set if we are fallen behind i.e. lost some channel state."
},
"feerate": {
"type": "object",
"description": "Feerates for the current tx",
Expand Down Expand Up @@ -749,6 +754,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
Expand Down Expand Up @@ -843,6 +849,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
Expand Down Expand Up @@ -936,6 +943,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"short_channel_id": {},
"channel_id": {},
Expand Down Expand Up @@ -1030,6 +1038,7 @@
"channel_type": {},
"feerate": {},
"ignore_fee_limits": {},
"lost_state": {},
"owner": {},
"alias": {},
"short_channel_id": {},
Expand Down
1 change: 1 addition & 0 deletions lightningd/dual_open_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void json_add_unsaved_channel(struct json_stream *response,
json_add_string(response, "owner", channel->owner->name);
json_add_string(response, "opener", channel->opener == LOCAL ?
"local" : "remote");
json_add_bool(response, "lost_state", channel->future_per_commitment_point ? true : false);
json_array_start(response, "status");
for (size_t i = 0; i < ARRAY_SIZE(channel->billboard.permanent); i++) {
if (!channel->billboard.permanent[i])
Expand Down
1 change: 1 addition & 0 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,7 @@ static void json_add_channel(struct lightningd *ld,
bitcoin_tx_compute_fee(channel->last_tx));
}

json_add_bool(response, "lost_state", channel->future_per_commitment_point ? true : false);
json_object_start(response, "feerate");
feerate = get_feerate(channel->fee_states, channel->opener, LOCAL);
json_add_u32(response, feerate_style_name(FEERATE_PER_KSIPA), feerate);
Expand Down

0 comments on commit 9acc1d7

Please sign in to comment.