From 45cb1d174e3f3f95548fdebd929a2dd45e49ba00 Mon Sep 17 00:00:00 2001 From: Dread <34528298+islandbitcoin@users.noreply.github.com> Date: Mon, 31 Oct 2022 19:00:16 -0400 Subject: [PATCH] Hotfix/peers (#82) * hotfix for peers on first run * wip * hotfix for peers on first run * more resilient peer add * change sh to bash * remove extraneous var Co-authored-by: Dread Co-authored-by: Aiden McClelland Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> --- .dockerignore | 6 ++++++ .gitignore | 3 ++- docker_entrypoint.sh | 24 +++++++++++++++++++++++- manifest.yaml | 4 ++-- scripts/services/migrations.ts | 2 +- 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a5804fc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +lnd/.git +configurator +!configurator/target/aarch64-unknown-linux-musl/release/configurator +health-check +!health-check/target/aarch64-unknown-linux-musl/release/health-check diff --git a/.gitignore b/.gitignore index 9e16d31..351c77a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ image.tar lnd.s9pk scripts/embassy.js -.vscode/ \ No newline at end of file +.vscode/ +docker-images/ \ No newline at end of file diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh index 0e2a9a8..5f049c6 100755 --- a/docker_entrypoint.sh +++ b/docker_entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e @@ -12,11 +12,33 @@ _term() { export HOST_IP=$(ip -4 route list match 0/0 | awk '{print $3}') export CONTAINER_IP=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') +# ----------Hotfix for bootstrapping peers---------- +addpeers() { + lncli connect 03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f@3.33.236.230:9735 || >&2 echo 'Failed to add fallback peer #1' + lncli connect 02bba49d7f9c57b9c05f7eb33bf4dc69b2aa37cb63caff93f13bfa88135e7f7a46@212.129.58.219:9739 || >&2 echo 'Failed to add fallback peer #2' + lncli connect 033dee9c6a0afc40ffd8f27d68ef260f3e5e1c19e59c6f9bb607fb04c1d497a809@98.165.150.209:9735 || >&2 echo 'Failed to add fallback peer #3' +} +# ----------End of Hotfix--------------------------- + configurator configurator_child=$! lnd & lnd_child=$! +# ----------Hotfix for bootstrapping peers---------- +sleep 60 +regex='"synced_to_chain"\s*:\s*true' +while true; do + echo 'checking for sync to chain...' + if [[ "$(lncli getinfo)" =~ $regex ]]; then + addpeers + break + fi + echo 'waiting to add peers...' + sleep 5 +done +# ----------End of Hotfix--------------------------- + trap _term SIGTERM wait $lnd_child $configurator_child diff --git a/manifest.yaml b/manifest.yaml index 25d7c86..d5432d7 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -1,8 +1,8 @@ id: lnd title: Lightning Network Daemon -version: 0.15.2 +version: 0.15.2.1 release-notes: |- - * New LND v0.15.2-beta: [Upstream Release Notes](https://github.com/lightningnetwork/lnd/blob/master/docs/release-notes/release-notes-0.15.2.md) + * Minor hotfix for bootstrapping peers on first run license: mit wrapper-repo: "https://github.com/Start9Labs/lnd-wrapper" upstream-repo: "https://github.com/lightningnetwork/lnd" diff --git a/scripts/services/migrations.ts b/scripts/services/migrations.ts index a3670d0..0784a99 100644 --- a/scripts/services/migrations.ts +++ b/scripts/services/migrations.ts @@ -134,5 +134,5 @@ export const migration: T.ExpectedExports.migration = compat.migrations down: () => { throw new Error('Cannot downgrade') }, }, }, - "0.15.0", + "0.15.2.1", ); \ No newline at end of file