Skip to content

Commit 6889d36

Browse files
committed
reckless: rust rewrite
Changelog-None
1 parent 01074ef commit 6889d36

32 files changed

Lines changed: 5123 additions & 2790 deletions

File tree

Cargo.lock

Lines changed: 137 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ members = [
2020
"plugins/wss-proxy-plugin",
2121
"plugins/bip353-plugin",
2222
"plugins/currencyrate-plugin",
23+
"plugins/reckless-plugin",
2324
]
2425

2526
[workspace.dependencies]

Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,7 @@ ALL_NONGEN_SRCFILES := $(ALL_NONGEN_HEADERS) $(ALL_NONGEN_SOURCES)
460460
BIN_PROGRAMS = \
461461
cli/lightning-cli \
462462
lightningd/lightningd \
463-
tools/lightning-hsmtool\
464-
tools/reckless
463+
tools/lightning-hsmtool
465464
PKGLIBEXEC_PROGRAMS = \
466465
lightningd/lightning_channeld \
467466
lightningd/lightning_closingd \
@@ -867,7 +866,7 @@ clean: obsclean
867866

868867
# See doc/contribute-to-core-lightning/contributor-workflow.md
869868
PYLNS=client proto testing
870-
update-versions: update-pyln-versions update-reckless-version update-dot-version # FIXME: update-doc-examples
869+
update-versions: update-pyln-versions update-dot-version # FIXME: update-doc-examples
871870
@uv lock
872871

873872
update-pyln-versions: $(PYLNS:%=update-pyln-version-%)
@@ -905,11 +904,6 @@ pyln-build-all: pyln-build pyln-build-bolts pyln-build-grpc-proto pyln-build-wss
905904
update-lock:
906905
uv sync --all-extras --all-groups
907906

908-
update-reckless-version:
909-
@if [ -z "$(NEW_VERSION)" ]; then echo "Set NEW_VERSION!" >&2; exit 1; fi
910-
@echo "Updating tools/reckless to $(NEW_VERSION)"
911-
@$(SED) -i.bak "s/__VERSION__ = '.*'/__VERSION__ = '$(NEW_VERSION)'/" tools/reckless && rm tools/reckless.bak
912-
913907
update-dot-version:
914908
@if [ -z "$(NEW_VERSION)" ]; then echo "Set NEW_VERSION!" >&2; exit 1; fi
915909
echo $(NEW_VERSION) > .version

contrib/pyln-testing/pyln/testing/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ def __init__(self, node_id, lightning_dir, bitcoind, executor, may_fail=False,
10091009
if dsn is not None:
10101010
self.daemon.opts['wallet'] = dsn
10111011
if VALGRIND:
1012-
trace_skip_pattern = '*python*,*bitcoin-cli*,*elements-cli*,*cln-grpc*,*clnrest*,*wss-proxy*,*cln-bip353*,*reckless,*cln-currencyrate*'
1012+
trace_skip_pattern = '*python*,*bitcoin-cli*,*elements-cli*,*cln-grpc*,*clnrest*,*wss-proxy*,*cln-bip353*,*reckless,*cln-currencyrate*,*cln-reckless*'
10131013
if not valgrind_plugins:
10141014
trace_skip_pattern += ',*plugins*'
10151015
self.daemon.cmd_prefix = [

plugins/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ cln-xpay
2323
cln-lsps-client
2424
cln-lsps-service
2525
cln-bwatch
26+
cln-reckless

plugins/Makefile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,6 @@ PLUGIN_FUNDER_HEADER := \
8787
plugins/funder_policy.h
8888
PLUGIN_FUNDER_OBJS := $(PLUGIN_FUNDER_SRC:.c=.o)
8989

90-
PLUGIN_RECKLESSRPC_SRC := plugins/recklessrpc.c
91-
PLUGIN_RECKLESSRPC_OBJS := $(PLUGIN_RECKLESSRPC_SRC:.c=.o)
92-
9390
PLUGIN_ALL_SRC := \
9491
$(PLUGIN_AUTOCLEAN_SRC) \
9592
$(PLUGIN_chanbackup_SRC) \
@@ -106,8 +103,7 @@ PLUGIN_ALL_SRC := \
106103
$(PLUGIN_PAY_LIB_SRC) \
107104
$(PLUGIN_PAY_SRC) \
108105
$(PLUGIN_SPENDER_SRC) \
109-
$(PLUGIN_RECOVER_SRC) \
110-
$(PLUGIN_RECKLESSRPC_SRC)
106+
$(PLUGIN_RECOVER_SRC)
111107

112108
PLUGIN_ALL_HEADER := \
113109
$(PLUGIN_PAY_HEADER) \
@@ -130,7 +126,6 @@ C_PLUGINS := \
130126
plugins/keysend \
131127
plugins/offers \
132128
plugins/pay \
133-
plugins/recklessrpc \
134129
plugins/recover \
135130
plugins/txprepare \
136131
plugins/cln-renepay \
@@ -153,7 +148,7 @@ $(shell test -d plugins/clnrest && $(RM) -r plugins/clnrest || true)
153148
$(shell test -d plugins/wss-proxy && $(RM) -r plugins/wss-proxy || true)
154149

155150
ifneq ($(RUST),0)
156-
RUST_PLUGIN_NAMES := cln-grpc clnrest cln-lsps-client cln-lsps-service wss-proxy cln-bip353 cln-currencyrate
151+
RUST_PLUGIN_NAMES := cln-grpc clnrest cln-lsps-client cln-lsps-service wss-proxy cln-bip353 cln-currencyrate cln-reckless
157152

158153
# Builtin plugins must be in this plugins dir to work when we're executed
159154
# *without* make install.
@@ -218,8 +213,6 @@ plugins/funder: $(PLUGIN_FUNDER_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a
218213

219214
plugins/recover: $(PLUGIN_RECOVER_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a
220215

221-
plugins/recklessrpc: $(PLUGIN_RECKLESSRPC_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a
222-
223216
# This covers all the low-level list RPCs which return simple arrays
224217
SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listclosedchannels listtransactions listsendpays listchainmoves listchannelmoves bkpr-listaccountevents bkpr-listincome listnetworkevents
225218
SQL_LISTRPCS_SCHEMAS := $(foreach l,$(SQL_LISTRPCS),doc/schemas/$l.json)
@@ -274,6 +267,7 @@ CLN_LSPS_PLUGIN_SRC = $(shell find plugins/lsps-plugin/src -name "*.rs")
274267
CLN_WSS_PROXY_PLUGIN_SRC = $(shell find plugins/wss-proxy-plugin/src -name "*.rs")
275268
CLN_BIP353_PLUGIN_SRC = $(shell find plugins/bip353-plugin/src -name "*.rs")
276269
CLN_CURRENCYRATE_PLUGIN_SRC = $(shell find plugins/currencyrate-plugin/src -name "*.rs")
270+
CLN_RECKLESS_PLUGIN_SRC = $(shell find plugins/reckless-plugin/src -name "*.rs")
277271

278272
$(RUST_TARGET_DIR)/cln-grpc: ${CLN_PLUGIN_SRC} ${CLN_GRPC_PLUGIN_SRC} $(MSGGEN_GENALL) $(MSGGEN_GEN_ALL)
279273
$(CARGO) build ${CARGO_OPTS} --bin cln-grpc
@@ -289,11 +283,13 @@ $(RUST_TARGET_DIR)/cln-bip353: ${CLN_BIP353_PLUGIN_SRC}
289283
$(CARGO) build ${CARGO_OPTS} --bin cln-bip353
290284
$(RUST_TARGET_DIR)/cln-currencyrate: ${CLN_CURRENCYRATE_PLUGIN_SRC}
291285
$(CARGO) build ${CARGO_OPTS} --bin cln-currencyrate
286+
$(RUST_TARGET_DIR)/cln-reckless: ${CLN_RECKLESS_PLUGIN_SRC}
287+
$(CARGO) build ${CARGO_OPTS} --bin cln-reckless
292288

293289
ifneq ($(RUST),0)
294290
include plugins/rest-plugin/Makefile
295291
include plugins/wss-proxy-plugin/Makefile
296-
DEFAULT_TARGETS += $(CLN_PLUGIN_EXAMPLES) plugins/cln-grpc plugins/clnrest plugins/cln-lsps-client plugins/cln-lsps-service plugins/wss-proxy plugins/cln-bip353 plugins/cln-currencyrate
292+
DEFAULT_TARGETS += $(CLN_PLUGIN_EXAMPLES) plugins/cln-grpc plugins/clnrest plugins/cln-lsps-client plugins/cln-lsps-service plugins/wss-proxy plugins/cln-bip353 plugins/cln-currencyrate plugins/cln-reckless
297293
endif
298294

299295
clean: plugins-clean

plugins/reckless-plugin/Cargo.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[package]
2+
name = "cln-reckless"
3+
version = "0.1.0"
4+
edition = "2024"
5+
license = "MIT"
6+
description = "Install plugins from remote or local repositories"
7+
homepage = "https://github.com/ElementsProject/lightning/tree/master/plugins"
8+
repository = "https://github.com/ElementsProject/lightning"
9+
rust-version.workspace = true
10+
11+
[dependencies]
12+
anyhow = "1"
13+
log = { version = "0.4", features = ['std'] }
14+
serde = { version = "1", features = ["derive"] }
15+
serde_json = "1"
16+
tokio = { version = "1", features = ["fs", "process"] }
17+
tokio-util = { version = "0.7", features = ["codec"] }
18+
19+
futures = "0.3"
20+
21+
log-panics = "2"
22+
23+
which = "8"
24+
url = "2"
25+
sha2 = "0.11"
26+
chrono = "0.4"
27+
hex = "0.4"
28+
29+
clap = { version = "4", features = ["derive"] }
30+
31+
cln-plugin = { workspace = true }
32+
cln-rpc = { workspace = true }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pub mod enable;
2+
pub mod install;
3+
pub mod search;
4+
pub mod source;
5+
pub mod tip;
6+
pub mod update;
7+
pub mod version;

0 commit comments

Comments
 (0)