Skip to content

Commit

Permalink
Plugins: Add recover plugin which'd identify if we've lost some state…
Browse files Browse the repository at this point in the history
… and try to recover the node by entering mode.
  • Loading branch information
adi2011 authored and cdecker committed Feb 16, 2024
1 parent 9acc1d7 commit 4031baf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
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
23 changes: 23 additions & 0 deletions plugins/recover.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "config.h"
#include <ccan/array_size/array_size.h>
#include <common/features.h>
#include <common/gossmap.h>
#include <common/hsm_encryption.h>
#include <common/json_param.h>
#include <common/json_stream.h>
#include <common/type_to_string.h>
#include <errno.h>
#include <plugins/libplugin.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
setup_locale();

plugin_main(argv, init, PLUGIN_STATIC, true, NULL,
NULL, 0,
NULL, 0, NULL, 0,
NULL, 0, /* Notification topics we publish */
NULL);
}

0 comments on commit 4031baf

Please sign in to comment.