Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover plugin to automate recovery in CLN #6853

Merged
merged 6 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
1 change: 1 addition & 0 deletions plugins/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ chanbackup
commando
sql
cln-renepay
recover
9 changes: 8 additions & 1 deletion plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ PLUGIN_SPENDER_HEADER := \
plugins/spender/openchannel.h
PLUGIN_SPENDER_OBJS := $(PLUGIN_SPENDER_SRC:.c=.o)

PLUGIN_RECOVER_SRC := plugins/recover.c
PLUGIN_RECOVER_OBJS := $(PLUGIN_RECOVER_SRC:.c=.o)

PLUGIN_FUNDER_SRC := \
plugins/funder.c \
plugins/funder_policy.c
Expand All @@ -78,7 +81,8 @@ PLUGIN_ALL_SRC := \
$(PLUGIN_OFFERS_SRC) \
$(PLUGIN_PAY_LIB_SRC) \
$(PLUGIN_PAY_SRC) \
$(PLUGIN_SPENDER_SRC)
$(PLUGIN_SPENDER_SRC) \
$(PLUGIN_RECOVER_SRC)

PLUGIN_ALL_HEADER := \
$(PLUGIN_PAY_HEADER) \
Expand All @@ -99,6 +103,7 @@ C_PLUGINS := \
plugins/keysend \
plugins/offers \
plugins/pay \
plugins/recover \
plugins/txprepare \
plugins/cln-renepay \
plugins/spenderp
Expand Down Expand Up @@ -216,6 +221,8 @@ plugins/fetchinvoice: $(PLUGIN_FETCHINVOICE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_CO

plugins/funder: bitcoin/psbt.o common/psbt_open.o $(PLUGIN_FUNDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)

plugins/recover: common/gossmap.o common/fp16.o $(PLUGIN_RECOVER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)

# This covers all the low-level list RPCs which return simple arrays
SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listclosedchannels listtransactions listsendpays bkpr-listaccountevents bkpr-listincome
SQL_LISTRPCS_SCHEMAS := $(foreach l,$(SQL_LISTRPCS),doc/schemas/$l.schema.json)
Expand Down
Loading
Loading