From c32782583fd9bf1e40056971883d65fc1fa38323 Mon Sep 17 00:00:00 2001 From: keyan Date: Sat, 9 Mar 2024 15:40:00 -0600 Subject: [PATCH] add auto-mining --- .env.sample | 2 ++ docker-compose.yml | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index fe77d47a..70f53f9c 100644 --- a/.env.sample +++ b/.env.sample @@ -115,11 +115,13 @@ LND_GRPC_PORT=10009 LND_P2P_PORT=9735 # docker exec -u lnd sn_lnd lncli newaddress p2tr --unused LND_ADDR=bcrt1phujdlvh2ttfdxcsc2c3p3vv6g5uutua9pr846r94ae33636gxy7qkly70z +LND_PUBKEY=02cb2e2d5a6c5b17fa67b1a883e2973c82e328fb9bd08b2b156a9e23820c87a490 # stacker lnd container stuff STACKER_LND_REST_PORT=9090 STACKER_LND_GRPC_PORT=10010 # docker exec -u lnd stacker_lnd lncli newaddress p2tr --unused STACKER_LND_ADDR=bcrt1pn0ach38n7k5ejxw7e2mx02gqe237em7d9eev3dcd2yst3tlyhtdswkgd89 +STACKER_LND_PUBKEY=028093ae52e011d45b3e67f2e0f2cb6c3a1d7f88d2920d408f3ac6db3a56dc4b35 LNCLI_NETWORK=regtest \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 276116e3..4180eb9d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -156,7 +156,7 @@ services: restart: unless-stopped stop_grace_period: '5m' healthcheck: - test: ["CMD", "bitcoin-cli", "-rpcport=${RPC_PORT}", "-rpcuser=${RPC_USER}", "-rpcpassword=${RPC_PASS}", "getblockchaininfo"] + test: ["CMD", "bitcoin-cli", "-chain=regtest", "-rpcport=${RPC_PORT}", "-rpcuser=${RPC_USER}", "-rpcpassword=${RPC_PASS}", "getblockchaininfo"] interval: 10s timeout: 10s retries: 10 @@ -188,6 +188,16 @@ services: - "${ZMQ_TX_PORT}" volumes: - bitcoin:/home/bitcoin/.bitcoin + labels: + ofelia.enabled: "true" + ofelia.job-exec.minecron.schedule: "@every 2m" + ofelia.job-exec.minecron.command: > + bash -c ' + echo "Mining a block to sn_lnd..." + bitcoin-cli -chain=regtest -rpcport=${RPC_PORT} -rpcuser=${RPC_USER} -rpcpassword=${RPC_PASS} generatetoaddress 1 ${LND_ADDR} + sleep 60 + echo "Mining a block to stacker_lnd..." + bitcoin-cli -chain=regtest -rpcport=${RPC_PORT} -rpcuser=${RPC_USER} -rpcpassword=${RPC_PASS} generatetoaddress 1 ${STACKER_LND_ADDR}' sn_lnd: build: context: ./docker/lnd @@ -229,6 +239,7 @@ services: - '--protocol.wumbo-channels' - '--maxchansize=1000000000' - '--allow-circular-route' + - '--bitcoin.defaultchanconfs=0' expose: - "${LND_P2P_PORT}" ports: @@ -279,6 +290,7 @@ services: - '--protocol.wumbo-channels' - '--maxchansize=1000000000' - '--allow-circular-route' + - '--bitcoin.defaultchanconfs=0' expose: - "${LND_P2P_PORT}" ports: @@ -286,6 +298,15 @@ services: - "${STACKER_LND_GRPC_PORT}:${LND_GRPC_PORT}" volumes: - stacker_lnd:/home/lnd/.lnd + channdler: + image: mcuadros/ofelia:latest + container_name: channdler + depends_on: + - bitcoin + restart: unless-stopped + command: daemon --docker -f label=com.docker.compose.project=${COMPOSE_PROJECT_NAME} + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro volumes: db: os: