diff --git a/data/eclair/eclair.conf b/data/eclair/eclair.conf new file mode 100644 index 0000000..f97fb82 --- /dev/null +++ b/data/eclair/eclair.conf @@ -0,0 +1,27 @@ +eclair { + chain = "regtest" + + api { + enabled = true + port = 8080 + password = "lnbits" + } + + bitcoind { + host = "bitcoind" + rpcport = 18443 + rpcuser = "lnbits" + rpcpassword = "lnbits" + + zmqblock = "tcp://bitcoind:29001" + zmqtx = "tcp://bitcoind:29000" + } + + channel { + max-funding-satoshis = 10000000000 + } + + features { + option_support_large_channel = mandatory + } +} diff --git a/docker-compose.yml b/docker-compose.yml index d42931f..1525a6e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -116,6 +116,19 @@ services: volumes: - ./data/lnd-3:/root/.lnd/ + eclair: + hostname: eclair + depends_on: + - bitcoind + image: boltz/eclair:0.8.0 + restart: on-failure + entrypoint: "sh -c 'sleep 20; /eclair-node/bin/eclair-node.sh -Declair.datadir=/root/eclair -Declair.printToConsole'" + expose: + - 9735 + - 8080 + volumes: + - ./data/eclair:/root/eclair + electrs: depends_on: - bitcoind diff --git a/docker-scripts.sh b/docker-scripts.sh index a85e6ef..80b8d82 100644 --- a/docker-scripts.sh +++ b/docker-scripts.sh @@ -19,6 +19,18 @@ lncli-sim() { docker exec lnbits-legend-lnd-$i-1 lncli --network regtest --rpcserver=lnd-$i:10009 $@ } +get-eclair-pubkey() { + while true; do + pubkey=$(docker exec -it lnbits-legend-eclair-1 curl http://localhost:8080/getinfo -X POST -u :lnbits 2> /dev/null | jq -r .nodeId 2> /dev/null) + pubkeyPrefix=$(echo $pubkey | cut -c1,2) + if [[ "$pubkeyPrefix" == "02" || "$pubkeyPrefix" == "03" ]]; then + echo $pubkey + break + fi + sleep 1 + done +} + # args(i) fund_clightning_node() { address=$(lightning-cli-sim $1 newaddr | jq -r .bech32) @@ -54,7 +66,7 @@ lnbits-regtest-start-log(){ lnbits-regtest-stop(){ docker compose down --volumes # clean up lightning node data - sudo rm -rf ./data/clightning-1 ./data/clightning-2 ./data/lnd-1 ./data/lnd-2 ./data/lnd-3 ./data/boltz/boltz.db + sudo rm -rf ./data/clightning-1 ./data/clightning-2 ./data/lnd-1 ./data/lnd-2 ./data/lnd-3 ./data/boltz/boltz.db ./data/eclair/regtest # recreate lightning node data folders preventing permission errors mkdir ./data/clightning-1 ./data/clightning-2 ./data/lnd-1 ./data/lnd-2 ./data/lnd-3 } @@ -157,6 +169,13 @@ lnbits-lightning-init(){ echo "open channel from cln-1 to cln-2" lightning-cli-sim 1 fundchannel -k id=$peerid amount=$channel_size push_msat=$balance_size_msat > /dev/null + # lnd-1 -> eclair-1 + lncli-sim 1 connect $(get-eclair-pubkey)@lnbits-legend-eclair-1 > /dev/null + echo "open channel from lnd-1 to eclair-1" + lncli-sim 1 openchannel $(get-eclair-pubkey) $channel_size $balance_size > /dev/null + bitcoin-cli-sim -generate 10 > /dev/null + wait-for-lnd-channel 1 + bitcoin-cli-sim -generate 10 > /dev/null wait-for-clightning-channel 1 diff --git a/tests b/tests index f70967d..d876712 100755 --- a/tests +++ b/tests @@ -20,7 +20,7 @@ run(){ } failed="false" -blockheight=230 +blockheight=240 utxos=5 channel_size=24000000 # 0.024 btc balance_size=12000000 # 0.012 btc @@ -36,7 +36,9 @@ for i in 1 2 3; do run "lnd-$i .synced_to_chain" "true" $(lncli-sim $i getinfo | jq -r ".synced_to_chain") run "lnd-$i utxo count" $utxos $(lncli-sim $i listunspent | jq -r ".utxos | length") run "lnd-$i .block_height" $blockheight $(lncli-sim $i getinfo | jq -r ".block_height") - if [[ "$i" == "2" ]]; then + if [[ "$i" == "1" ]]; then + channel_count=4 + elif [[ "$i" == "2" ]]; then channel_count=2 else channel_count=3 @@ -55,6 +57,8 @@ for i in 1 2; do run "cln-$i channel[0].channel_sat" $balance_size $(lightning-cli-sim $i listfunds | jq -r ".channels[0].channel_sat") done +run "eclair-1 openchannels" 1 $(docker exec -it lnbits-legend-eclair-1 curl http://localhost:8080/channels -X POST -u :lnbits | jq '. | length') + run "boltz service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:9001/version") run "mempool service status" "200" $(curl -s -o /dev/null --head -w "%{http_code}" "http://localhost:8080/") run "lnbits service status" "200" $(curl -s -o /dev/null -w "%{http_code}" "http://localhost:5001/")