From d904ba3c2cb78bd9dff22f37db154961892ccc58 Mon Sep 17 00:00:00 2001 From: Mayank Date: Thu, 21 May 2020 14:43:03 +0530 Subject: [PATCH] removed lnd-unlock --- build/lnd-unlock/Dockerfile | 11 ------- build/lnd-unlock/unlock.sh | 57 ------------------------------------- db/jwt-private-key/.gitkeep | 0 db/jwt-public-key/.gitkeep | 0 docker-compose.yml | 9 ------ 5 files changed, 77 deletions(-) delete mode 100644 build/lnd-unlock/Dockerfile delete mode 100755 build/lnd-unlock/unlock.sh create mode 100644 db/jwt-private-key/.gitkeep create mode 100644 db/jwt-public-key/.gitkeep diff --git a/build/lnd-unlock/Dockerfile b/build/lnd-unlock/Dockerfile deleted file mode 100644 index 33936c2..0000000 --- a/build/lnd-unlock/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM alpine:3.10 - -RUN apk add --no-cache curl jq - -RUN mkdir /lnd/ - -COPY unlock.sh /bin/unlock - -RUN chmod +x /bin/unlock - -ENTRYPOINT ["unlock"] diff --git a/build/lnd-unlock/unlock.sh b/build/lnd-unlock/unlock.sh deleted file mode 100755 index 4ae00a2..0000000 --- a/build/lnd-unlock/unlock.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -HOST=localhost:8080 -TLS_CERT=/lnd/tls.cert -LNDPASSWORD_PATH=/secrets/lnd-password.txt -MACAROON_PATH=/lnd/data/chain/bitcoin/mainnet/admin.macaroon - -lncurl() { - MACAROON="$(xxd -p /lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n')" - url_path=$1 - data=$2 - - curl --fail --silent --show-error \ - --cacert "${TLS_CERT}" \ - --header "Grpc-Metadata-macaroon: ${MACAROON}" \ - --data "${data}" \ - "https://${HOST}/v1/${url_path}" -} - -while true; do - # First make sure that port is open - while ! nc -z localhost 8080; do - >&2 echo "Waiting for ${HOST} port to open…" - sleep 3 - done - >&2 echo "Port ${HOST} is open" - - # Wait a bit more in case the port was just opened - sleep 1 - if [[ -f $LNDPASSWORD_PATH ]]; then - if [[ -f $MACAROON_PATH ]]; then - >&2 echo "Password and macaroon file file exists" - PASS="$(cat /secrets/lnd-password.txt | tr -d '\n' | base64 | tr -d '\n')" - UNLOCK_PAYLOAD="$(jq -nc --arg wallet_password ${PASS} '{$wallet_password}')" - # Try getinfo then unlock - >&2 echo "Trying ${HOST}/getinfo…" - INFO=$(lncurl getinfo) - if [ "$?" = "0" ]; then - >&2 echo "Response: ${INFO}" - alias="$(echo "${INFO}" | jq '.alias')" - >&2 echo "Wallet for ${alias} unlocked!" - exit 0 - fi - >&2 echo "${HOST}/getinfo FAILED, out=${INFO}" - - >&2 echo "Trying ${HOST}/unlockwallet…" - RESULT=$(lncurl unlockwallet "${UNLOCK_PAYLOAD}") - >&2 echo "${HOST}/unlockwallet completed with: exit-code=$?, out=${RESULT}" - else - >&2 echo "macaroon file doesn't exist" - fi - else - >&2 echo "password file doesn't exist" - fi - - sleep 30 -done diff --git a/db/jwt-private-key/.gitkeep b/db/jwt-private-key/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/db/jwt-public-key/.gitkeep b/db/jwt-public-key/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml index 7f58666..cf92b07 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -55,12 +55,3 @@ services: RPC_PASSWORD: "" LND_NETWORK: "mainnet" LND_HOST: "127.0.0.1" - lnd-unlock: - build: ${HOME}/build/lnd-unlock/ - depends_on: [ lnd ] - logging: *default-logging - restart: always - volumes: - - "${HOME}/lnd:/lnd" - - "${HOME}/secrets:/secrets" - network_mode: host