Skip to content

Commit

Permalink
Update/v24.02.1 (#123)
Browse files Browse the repository at this point in the history
* fix wt-client bug causing it to always be enabled

* update upstream to 24.02

* set UI APP_PROTOCOL to https

* add experimental splicing config option

* fix wt-client setConfig

* replace deprecated experimental-websocket-port with bind-addr

* set splicing config to required: false

* add required minor version

* add sling remove summary and rebalance

* rescan-blockchain wip

* update lightning to 24.02.1

* revert action_result value to null

* rebuild image on changes to actions

* revert APP_PROTOCOL to http until nginx is added

* update migrations and config descriptions

* complete rescan-blockchain action

* update release notes

* update Splicing and Sling Default to Disabled

* update plugins submodule
  • Loading branch information
Dominion5254 authored Mar 29, 2024
1 parent fa7e834 commit fbbad85
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 67 deletions.
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN rustup toolchain install stable --component rustfmt --allow-downgrade
RUN rustup toolchain install beta

# sling
ADD ./plugins/sling /tmp/rust-sling
WORKDIR /tmp/rust-sling
RUN cargo build --release

# build rust-teos
COPY ./rust-teos /tmp/rust-teos
WORKDIR /tmp/rust-teos
Expand Down Expand Up @@ -195,16 +200,6 @@ RUN pip3 install -U pip
RUN pip3 install wheel
RUN pip3 install -U pyln-proto pyln-bolt7

# rebalance
ADD ./plugins/rebalance /usr/local/libexec/c-lightning/plugins/rebalance
RUN pip3 install -r /usr/local/libexec/c-lightning/plugins/rebalance/requirements.txt
RUN chmod a+x /usr/local/libexec/c-lightning/plugins/rebalance/rebalance.py

# summary
ADD ./plugins/summary /usr/local/libexec/c-lightning/plugins/summary
RUN pip3 install -r /usr/local/libexec/c-lightning/plugins/summary/requirements.txt
RUN chmod a+x /usr/local/libexec/c-lightning/plugins/summary/summary.py

# c-lightning-REST
ADD ./c-lightning-REST /usr/local/libexec/c-lightning/plugins/c-lightning-REST
WORKDIR /usr/local/libexec/c-lightning/plugins/c-lightning-REST
Expand All @@ -218,6 +213,10 @@ COPY --from=builder /root/.cargo/bin/teosd /usr/local/bin/teosd
COPY --from=builder /root/.cargo/bin/teos-cli /usr/local/bin/teos-cli
COPY --from=builder /root/.cargo/bin/watchtower-client /usr/local/libexec/c-lightning/plugins/watchtower-client

# sling
COPY --from=builder /tmp/rust-sling/target/release /usr/local/libexec/c-lightning/plugins/sling
RUN chmod a+x /usr/local/libexec/c-lightning/plugins/sling

# other scripts
ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod a+x /usr/local/bin/docker_entrypoint.sh
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ else
endif
@start-sdk pack

docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh check-rpc.sh check-synced.sh $(C_LIGHTNING_GIT_FILE) $(PLUGINS_SRC) $(C_LIGHTNING_REST_SRC) $(TEOS_SRC) manifest.yaml
docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh check-rpc.sh check-synced.sh $(C_LIGHTNING_GIT_FILE) $(PLUGINS_SRC) $(C_LIGHTNING_REST_SRC) $(TEOS_SRC) manifest.yaml ./actions/*
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg BITCOIN_VERSION=$(BITCOIN_VERSION) --build-arg ARCH=aarch64 --build-arg PLATFORM=arm64 --platform=linux/arm64/v8 -o type=docker,dest=docker-images/aarch64.tar .
endif

docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh check-rpc.sh check-synced.sh $(C_LIGHTNING_GIT_FILE) $(PLUGINS_SRC) $(C_LIGHTNING_REST_SRC) $(TEOS_SRC) manifest.yaml
docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh check-rpc.sh check-synced.sh $(C_LIGHTNING_GIT_FILE) $(PLUGINS_SRC) $(C_LIGHTNING_REST_SRC) $(TEOS_SRC) manifest.yaml ./actions/*
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
Expand Down
37 changes: 32 additions & 5 deletions actions/rescan-blockchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,36 @@
set -e

cat > input.json
BLOCKHEIGHT_OR_DEPTH=$(jq -r '.["blockheight-or-depth"]')
kill $(pidof lightningd)
echo -e "\nrescan=$BLOCKHEIGHT_OR_DEPTH" >> /root/.lightning/config
lightningd >> /tmp/cln.rescan.log &
BLOCKHEIGHT_OR_DEPTH=$(jq -r '.["blockheight-or-depth"]' input.json)
rm input.json
echo "$BLOCKHEIGHT_OR_DEPTH" > /root/.lightning/rescan.txt

sed -i '\nrescan='$BLOCKHEIGHT_OR_DEPTH'/d' /root/.lightning/config
if [ $BLOCKHEIGHT_OR_DEPTH -lt 0 ]; then
BLOCKHEIGHT=$(( -BLOCKHEIGHT_OR_DEPTH ))
SCAN_MESSAGE="from blockheight $BLOCKHEIGHT"
else
SCAN_MESSAGE="$BLOCKHEIGHT_OR_DEPTH blocks from the tip"
fi

action_result_running=" {
\"version\": \"0\",
\"message\": \"Core Lightning restarting and rescanning $SCAN_MESSAGE\",
\"value\": null,
\"copyable\": false,
\"qr\": false
}"
action_result_stopped=" {
\"version\": \"0\",
\"message\": \"On the next service start Core Lightning will rescan $SCAN_MESSAGE\",
\"value\": null,
\"copyable\": false,
\"qr\": false
}"

lightning-cli getinfo >/dev/null 2>/dev/null && EXIT_CODE=$? || EXIT_CODE=$?

if [ $EXIT_CODE -eq 0 ]; then
lightning-cli stop >/dev/null 2>/dev/null || echo $action_result_running
else
echo $action_result_stopped
fi
9 changes: 8 additions & 1 deletion docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ if [ $CLBOSS_ENABLED_VALUE = "enabled" ]; then
fi
fi

if [ -e /root/.lightning/rescan.txt ]; then
RESCAN=" --rescan=$(cat /root/.lightning/rescan.txt)"
echo $RESCAN
rm /root/.lightning/rescan.txt
fi

mkdir -p /root/.lightning/shared
mkdir -p /root/.lightning/public

Expand Down Expand Up @@ -111,7 +117,7 @@ else
fi

echo "Starting lightningd"
lightningd --database-upgrade=true$MIN_ONCHAIN$AUTO_CLOSE$ZEROBASEFEE$MIN_CHANNEL$MAX_CHANNEL &
lightningd --database-upgrade=true$MIN_ONCHAIN$AUTO_CLOSE$ZEROBASEFEE$MIN_CHANNEL$MAX_CHANNEL$RESCAN &
lightningd_child=$!

if [ "$(yq ".watchtowers.wt-server" /root/.lightning/start9/config.yaml)" = "true" ]; then
Expand Down Expand Up @@ -188,6 +194,7 @@ export APP_CORE_LIGHTNING_WEBSOCKET_PORT=4269
export COMMANDO_CONFIG="/root/.lightning/.commando-env"
export APP_CORE_LIGHTNING_PORT=4500
export APP_MODE=production
export APP_PROTOCOL="http"

EXISTING_PUBKEY=""
GETINFO_RESPONSE=""
Expand Down
2 changes: 1 addition & 1 deletion lightning
Submodule lightning updated 5974 files
57 changes: 30 additions & 27 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
id: c-lightning
version: 23.11.2.1
version: 24.02.1
title: Core Lightning
license: BSD-MIT
wrapper-repo: https://github.com/Start9Labs/cln-startos
upstream-repo: https://github.com/ElementsProject/lightning
support-site: https://github.com/ElementsProject/lightning/issues
marketing-site: https://blockstream.com/lightning
release-notes: |-
* Add Config option for [clnrest plugin](https://docs.corelightning.org/docs/rest)
* Add Config options for Autoclean
* Fix Watchtower Client bug
* Improve Config descriptions
* Update lightning to 24.02.1 - [Release Notes](https://github.com/ElementsProject/lightning/releases/tag/v24.02.1)
* Add Experimental 'Splicing' config option
* Replace archived 'Rebalance' plugin with 'Sling'
* Remove archived 'Summary' plugin
* Fix WT-Client bug
* Add action to rescan the blockchain from a specified blockheight or depth
build: ["make"]
description:
short: "An implementation of the Lightning Network protocol by Blockstream."
Expand Down Expand Up @@ -250,25 +252,26 @@ actions:
io-format: json
mounts:
main: /root/.lightning
# rescan-blockchain:
# name: "Rescan Blockchain"
# description: "Rescan the blockchain from a specified height or depth. If rescanning from a specific blockheight, enter a negative number i.e. '-600000' to rescan from block 600,000 to the tip. Alternatively, you can enter a positive number as the depth i.e. '10000' to rescan the last 10,000 blocks from the tip"
# allowed-statuses:
# - running
# implementation:
# type: docker
# image: main
# system: false
# entrypoint: rescan-blockchain.sh
# args: []
# io-format: json
# mounts:
# main: /root/.lightning
# input-spec:
# blockheight-or-depth:
# type: string
# name: Depth (or Blockheight if prefixed with a hyphen)
# description: Depth expressed as a positive number or blockheight prefixed with a hyphen.
# masked: false
# placeholder: "-600000"
# nullable: false
rescan-blockchain:
name: "Rescan Blockchain"
description: "Rescan the blockchain from a specified height or depth. If rescanning from a specific blockheight, enter a negative number i.e. '-600000' to rescan from block 600,000 to the tip. Alternatively, you can enter a positive number as the depth i.e. '10000' to rescan the last 10,000 blocks from the tip"
allowed-statuses:
- running
- stopped
implementation:
type: docker
image: main
system: false
entrypoint: rescan-blockchain.sh
args: []
io-format: json
mounts:
main: /root/.lightning
input-spec:
blockheight-or-depth:
type: string
name: Depth (or Blockheight if prefixed with a hyphen)
description: Depth expressed as a positive number or blockheight prefixed with a hyphen.
masked: false
placeholder: "-600000"
nullable: false
2 changes: 1 addition & 1 deletion plugins
Submodule plugins updated 99 files
+45 −1 .ci/test.py
+45 −43 .github/workflows/main.yml
+107 −0 .github/workflows/nightly.yml
+9 −3 .gitmodules
+5 −7 .mergify.yml
+1 −1 Dockerfile
+82 −66 README.md
+0 −0 archived/autopilot/README.md
+0 −0 archived/autopilot/__init__.py
+0 −0 archived/autopilot/autopilot.py
+0 −0 archived/autopilot/bech32.py
+0 −0 archived/autopilot/c-lightning-autopilot.py
+0 −0 archived/autopilot/lib_autopilot.py
+0 −0 archived/autopilot/pyproject.toml
+0 −0 archived/autopilot/test_autopilot.py
+13 −0 archived/commando/README.md
+0 −0 archived/commando/commando.py
+0 −0 archived/commando/requirements.txt
+0 −0 archived/commando/test_commando.py
+0 −0 archived/drain/README.md
+0 −0 archived/drain/__init__.py
+0 −0 archived/drain/clnutils.py
+0 −0 archived/drain/drain.py
+0 −0 archived/drain/requirements-dev.txt
+0 −0 archived/drain/requirements.txt
+0 −0 archived/drain/test_drain.py
+0 −0 archived/drain/utils.py
+0 −0 archived/helpme/Makefile
+0 −0 archived/helpme/README.md
+0 −0 archived/helpme/helpme.py
+0 −0 archived/helpme/requirements-dev.txt
+0 −0 archived/helpme/requirements.txt
+0 −0 archived/helpme/test_helpme.py
+0 −0 archived/historian/README.org
+0 −0 archived/historian/cli/backup.py
+0 −0 archived/historian/cli/common.py
+0 −0 archived/historian/cli/db.py
+0 −0 archived/historian/common.py
+0 −0 archived/historian/gossipd.py
+0 −0 archived/historian/historian-cli
+0 −0 archived/historian/historian.py
+7 −5 archived/historian/poetry.lock
+0 −0 archived/historian/pyproject.toml
+0 −0 archived/historian/test_historian.py
+0 −0 archived/jitrebalance/jitrebalance.py
+0 −0 archived/jitrebalance/requirements.txt
+0 −0 archived/jitrebalance/test_jitrebalance.py
+0 −0 archived/jitrebalance/tests/hold_htlcs.py
+0 −0 archived/jitrebalance/tests/refuse_htlcs.py
+10 −4 archived/noise/README.org
+13 −0 archived/noise/noise.py
+0 −0 archived/noise/onion.py
+0 −0 archived/noise/primitives.py
+2 −0 archived/noise/requirements-dev.txt
+1 −0 archived/noise/requirements.txt
+2 −2 archived/noise/test_chat.py
+0 −0 archived/noise/zbase32.py
+0 −0 archived/paytest/README.org
+0 −0 archived/paytest/paytest.py
+0 −0 archived/paytest/poetry.lock
+0 −0 archived/paytest/requirements.txt
+0 −0 archived/paytest/test_paytest.py
+0 −0 archived/probe/README.md
+0 −0 archived/probe/probe.py
+0 −0 archived/probe/requirements.txt
+0 −0 archived/probe/test_probe.py
+0 −0 archived/prometheus/README.md
+42 −31 archived/prometheus/prometheus.py
+0 −0 archived/prometheus/requirements.txt
+40 −0 archived/prometheus/test_prometheus.py
+0 −0 archived/summary/README.md
+0 −0 archived/summary/__init__.py
+0 −0 archived/summary/requirements.txt
+25 −14 archived/summary/summary.py
+0 −0 archived/summary/summary_avail.py
+22 −0 archived/summary/test_summary.py
+1 −2 backup/backend.py
+852 −592 backup/poetry.lock
+8 −8 backup/pyproject.toml
+10 −0 clearnet/README.md
+114 −0 clearnet/clearnet.py
+1 −0 clearnet/requirements.txt
+8 −2 clearnet/test_clearnet.py
+2 −2 currencyrate/README.md
+0 −6 currencyrate/currencyrate.py
+809 −552 donations/poetry.lock
+4 −3 donations/pyproject.toml
+61 −45 feeadjuster/feeadjuster.py
+55 −18 feeadjuster/test_feeadjuster.py
+1 −0 holdinvoice
+0 −1 nostrify
+39 −125 poetry.lock
+3 −3 pyproject.toml
+31 −30 rebalance/rebalance.py
+11 −0 rebalance/test_rebalance.py
+1 −1 sauron/requirements.txt
+4 −2 sauron/sauron.py
+1 −0 sling
+1 −0 summars
22 changes: 12 additions & 10 deletions scripts/procedures/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,13 @@ export const [getConfig, setConfigMatcher] = compat.getConfigAndMatcher({
description: "Allow channel shutdown with alternate txids. If a remote node has opened a channel, but claims it used the incorrect txid (and the channel hasn't yet been used) this allows them to negotiate a clean shutdown with the txid they offer. <b>Default: False</b>",
default: false,
},
"splicing": {
type: "boolean",
name: "Splicing",
description: "Enables support for the splicing protocol (bolt #863), allowing both parties to dynamically adjust the size a channel. These changes can be built interactively using PSBT and combined with other channel actions including dual fund, additional channel splices, or generic transaction activity. The operations will be bundled into a single transaction. The channel will remain active while awaiting splice confirmation, however you can only spend the smaller of the prior channel balance and the new one. <b>Default: Disabled</b>",
default: false,
required: false,
},
},
},
plugins: {
Expand All @@ -599,19 +606,14 @@ export const [getConfig, setConfigMatcher] = compat.getConfigAndMatcher({
description:
"Plugins are subprocesses that provide extra functionality and run alongside the lightningd process inside \nthe main Core Lightning container in order to communicate directly with it.\nTheir source is maintained separately from that of Core Lightning itself.",
spec: {
rebalance: {
type: "boolean",
name: "Rebalance",
description:
"Enables rebalancing, which moves liquidity between your channels using circular payments. As of early 2024, this can only be done in the CLI. <b>Default: False</b><br><b>Source: https://github.com/lightningd/plugins/tree/master/rebalance</b>",
default: false,
},
summary: {
sling: {
type: "boolean",
name: "Summary",
name: "Sling",
description:
"Enables the `summary` rpc command, which outputs a text summary of your node, including fiat amounts. This is a CLI-only tool. <b>Default: False</b><br><b>Source: https://github.com/lightningd/plugins/tree/master/summary</b>",
"Automatically rebalance multiple channels. This is a CLI-only tool. <b>Default: Disabled</b><br><b>Source: https://github.com/daywalker90/sling</b>",
default: false,
required: false,
nullable: true,
},
rest: {
type: "boolean",
Expand Down
24 changes: 23 additions & 1 deletion scripts/procedures/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,30 @@ export const migration: T.ExpectedExports.migration =
{ version: "23.11.2.1", type: "down" }
),
},
"24.02.1": {
up: compat.migrations.updateConfig(
(config) => {
if (matches.shape({
advanced: matches.shape({experimental: matches.any})
}).test(config)) {
config.advanced.experimental.splicing = false;
}
if (matches.shape({
advanced: matches.shape({plugins: matches.any})
}).test(config)) {
config.advanced.plugins.sling = false
}
return config;
},
true,
{ version: "24.02.1", type: "up"},
),
down: () => {
throw new Error("Cannot downgrade");
},
},
},
"23.11.2.1",
"24.02.1",
);

function generateRandomString(length: number) {
Expand Down
18 changes: 9 additions & 9 deletions scripts/procedures/setConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,8 @@ function configMaker(alias: Alias, config: SetConfig) {
]
? "experimental-shutdown-wrong-funding"
: "";
const enableRebalancePlugin = config.advanced.plugins.rebalance
? "plugin=/usr/local/libexec/c-lightning/plugins/rebalance/rebalance.py"
: "";
const enableSummaryPlugin = config.advanced.plugins.summary
? "plugin=/usr/local/libexec/c-lightning/plugins/summary/summary.py"
const enableSlingPlugin = config.advanced.plugins.sling
? "plugin=//usr/local/libexec/c-lightning/plugins/sling/sling"
: "";
const enableRestPlugin = config.advanced.plugins.rest
? "plugin=/usr/local/libexec/c-lightning/plugins/c-lightning-REST/clrest.js\nrest-port=3001\nrest-protocol=https\n"
Expand All @@ -299,9 +296,12 @@ function configMaker(alias: Alias, config: SetConfig) {
config.advanced.plugins.clboss.enabled === "enabled"
? "plugin=/usr/local/libexec/c-lightning/plugins/clboss"
: "";
const enableWatchtowerClientPlugin = config.watchtowers["wt-client"]
const enableWatchtowerClientPlugin = config.watchtowers["wt-client"].enabled === "enabled"
? "plugin=/usr/local/libexec/c-lightning/plugins/watchtower-client"
: "";
const enableSplicing = config.advanced.experimental.splicing
? "experimental-splicing"
: "";

return `
network=bitcoin
Expand Down Expand Up @@ -331,13 +331,13 @@ ${enableExperimentalDualFund}
experimental-onion-messages
experimental-offers
${enableExperimentalShutdownWrongFunding}
experimental-websocket-port=4269
${enableRebalancePlugin}
${enableSummaryPlugin}
bind-addr=ws::4269
${enableSlingPlugin}
${enableRestPlugin}
${enableCLNRestPlugin}
${enableClbossPlugin}
${enableWatchtowerClientPlugin}
${enableSplicing}
autoclean-cycle=${config.autoclean["autoclean-cycle"]}
autoclean-succeededforwards-age=${config.autoclean["autoclean-succeededforwards-age"]}
Expand Down

0 comments on commit fbbad85

Please sign in to comment.