Skip to content

Commit

Permalink
fix: wallet creation on start of lnd
Browse files Browse the repository at this point in the history
  • Loading branch information
DhananjayPurohit committed Jul 29, 2024
1 parent b577566 commit 550a6e5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 21 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,8 @@ jobs:
run: |
container_id_alice=$(docker ps -qf "name=mercurylayer_alice_1")
echo "Container ID: $container_id_alice"
docker exec $container_id_alice \
curl -X POST http://0.0.0.0:8080/v1/initwallet \
-H "Content-Type: application/json" \
-d '{"wallet_password": "password", "stateless_init": "true"}'
container_id_bob=$(docker ps -qf "name=mercurylayer_bob_1")
echo "Container ID: $container_id_bob"
docker exec $container_id_bob \
curl -X POST http://0.0.0.0:8080/v1/initwallet \
-H "Content-Type: application/json" \
-d '{"wallet_password": "password", "stateless_init": "true"}'
docker exec $container_id_alice \
curl -X POST http://0.0.0.0:8080/v1/unlockwallet \
-H "Content-Type: application/json" \
-d '{"wallet_password": "password"}'
docker exec $container_id_bob \
curl -X POST http://0.0.0.0:8080/v1/unlockwallet \
-H "Content-Type: application/json" \
-d '{"wallet_password": "password"}'
docker exec $container_id_alice lncli -n regtest getinfo
docker exec $container_id_bob lncli -n regtest getinfo
docker logs $container_id_alice
Expand Down
38 changes: 33 additions & 5 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ services:
bitcoind:
image: lncm/bitcoind:v22.0@sha256:37a1adb29b3abc9f972f0d981f45e41e5fca2e22816a023faa9fdc0084aa4507
user: root
command: -regtest -rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0 -rpcauth=user:63cf03615adebaa9356591f95b07ec7b$$920588e53f94798bda636acac1b6a77e10e3ee7fe57e414d62f3ee9e580cd27a -fallbackfee=0.0001
command: -regtest -rpcbind=0.0.0.0 -rpcallowip=0.0.0.0/0 -rpcauth=user:63cf03615adebaa9356591f95b07ec7b$$920588e53f94798bda636acac1b6a77e10e3ee7fe57e414d62f3ee9e580cd27a -fallbackfee=0.0001 -zmqpubhashblock=tcp://0.0.0.0:28332 -zmqpubhashtx=tcp://0.0.0.0:28333
ports:
- "18443:18443"
- "28332:28332"
- "28333:28333"
volumes:
- bitcoin_data:/root/.bitcoin

Expand Down Expand Up @@ -65,18 +67,30 @@ services:
- postgres

alice:
image: lightninglabs/lnd:v0.18.0-beta
image: lightninglabs/lndinit:v0.1.3-beta-lnd-v0.14.2-beta
user: root
hostname: lnd
entrypoint:
- sh
- -c
- |
if [[ ! -f /data/seed.txt ]]; then
lndinit gen-seed > /data/seed.txt
fi
if [[ ! -f /data/walletpassword.txt ]]; then
lndinit gen-password > /data/walletpassword.txt
fi
lndinit -v init-wallet \
--secret-source=file \
--file.seed=/data/seed.txt \
--file.wallet-password=/data/walletpassword.txt \
--init-file.output-wallet-dir=/root/.lnd/data/chain/bitcoin/regtest \
--init-file.validate-password
mkdir -p /data/.lnd
if [ ! -f "/data/.lnd/umbrel-lnd.conf" ]; then
touch "/data/.lnd/umbrel-lnd.conf"
fi
lnd --listen=0.0.0.0:9735 --rpclisten=0.0.0.0:10009 --restlisten=0.0.0.0:8080 --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind --bitcoind.rpchost=bitcoind --bitcoind.rpcuser=user --bitcoind.rpcpass=pass --bitcoind.zmqpubrawblock=tcp://bitcoind:28332 --bitcoind.zmqpubrawtx=tcp://bitcoind:28333 --configfile=/data/.lnd/umbrel-lnd.conf
lnd --listen=0.0.0.0:9735 --rpclisten=0.0.0.0:10009 --restlisten=0.0.0.0:8080 --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind --bitcoind.rpchost=bitcoind --bitcoind.rpcuser=user --bitcoind.rpcpass=pass --bitcoind.zmqpubrawblock=tcp://bitcoind:28332 --bitcoind.zmqpubrawtx=tcp://bitcoind:28333 --configfile=/data/.lnd/umbrel-lnd.conf --wallet-unlock-password-file=/data/walletpassword.txt --wallet-unlock-allow-create=true
ports:
- "9735:9735"
- "10009:10009"
Expand All @@ -86,22 +100,35 @@ services:
restart: unless-stopped
environment:
HOME: /data
command: [ '/init-wallet-k8s.sh' ]
depends_on:
- bitcoind

bob:
image: lightninglabs/lnd:v0.18.0-beta
image: lightninglabs/lndinit:v0.1.3-beta-lnd-v0.14.2-beta
user: root
hostname: lnd
entrypoint:
- sh
- -c
- |
if [[ ! -f /data/seed.txt ]]; then
lndinit gen-seed > /data/seed.txt
fi
if [[ ! -f /data/walletpassword.txt ]]; then
lndinit gen-password > /data/walletpassword.txt
fi
lndinit -v init-wallet \
--secret-source=file \
--file.seed=/data/seed.txt \
--file.wallet-password=/data/walletpassword.txt \
--init-file.output-wallet-dir=/root/.lnd/data/chain/bitcoin/regtest \
--init-file.validate-password
mkdir -p /data/.lnd
if [ ! -f "/data/.lnd/umbrel-lnd.conf" ]; then
touch "/data/.lnd/umbrel-lnd.conf"
fi
lnd --listen=0.0.0.0:9735 --rpclisten=0.0.0.0:10009 --restlisten=0.0.0.0:8080 --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind --bitcoind.rpchost=bitcoind --bitcoind.rpcuser=user --bitcoind.rpcpass=pass --bitcoind.zmqpubrawblock=tcp://bitcoind:28332 --bitcoind.zmqpubrawtx=tcp://bitcoind:28333 --configfile=/data/.lnd/umbrel-lnd.conf
lnd --listen=0.0.0.0:9735 --rpclisten=0.0.0.0:10009 --restlisten=0.0.0.0:8080 --bitcoin.active --bitcoin.regtest --bitcoin.node=bitcoind --bitcoind.rpchost=bitcoind --bitcoind.rpcuser=user --bitcoind.rpcpass=pass --bitcoind.zmqpubrawblock=tcp://bitcoind:28332 --bitcoind.zmqpubrawtx=tcp://bitcoind:28333 --configfile=/data/.lnd/umbrel-lnd.conf --wallet-unlock-password-file=/data/walletpassword.txt --wallet-unlock-allow-create=true
ports:
- "9736:9735"
- "10010:10009"
Expand All @@ -111,6 +138,7 @@ services:
restart: unless-stopped
environment:
HOME: /data
command: [ '/init-wallet-k8s.sh' ]
depends_on:
- bitcoind

Expand Down

0 comments on commit 550a6e5

Please sign in to comment.