diff --git a/docker/btcd/Dockerfile b/docker/btcd/Dockerfile index 66664155..e2445750 100644 --- a/docker/btcd/Dockerfile +++ b/docker/btcd/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.12-alpine as builder +FROM golang:1.18-alpine as builder MAINTAINER Olaoluwa Osuntokun diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 9e777408..f3be6325 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -5,7 +5,7 @@ services: image: ruimarinho/bitcoin-core:0.21.1 container_name: bitcoin-core volumes: - - ~/.bitcoin:/home/bitcoin/.bitcoin + - bitcoin:/home/bitcoin/.bitcoin ports: - 8332:8332 - 18332:18332 @@ -25,7 +25,7 @@ services: depends_on: - "tor-node" volumes: - - ~/.lnd:/root/.lnd + - lnd_client_dir:/root/.lnd - tor-dir:/var/lib/tor ports: - 10009:10009 @@ -69,7 +69,7 @@ services: - 10010:10009 - 9835:9835 volumes: - - ~/.lightning:/root/.lightning + - clightning_client_dir:/root/.lightning - tor-dir:/var/lib/tor links: - "bitcoin-core:bitcoin-core" @@ -151,8 +151,14 @@ services: entrypoint: ["./entrypoint.sh"] volumes: + bitcoin: + driver: local + lnd_client_dir: + driver: local lnd_server_dir: driver: local + clightning_client_dir: + driver: local clightning_server_dir: driver: local squeaknode_dir: diff --git a/docs/development.md b/docs/development.md index 10e464db..8a78548a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -32,9 +32,9 @@ You can also run your own squeaknode on your host machine. pip install . ``` -- Make sure that `~/.lnd` directory (created by docker container) has read permissions. You may need to change the permissions: +- Copy the `~/.lnd` directory from the docker container to your host machine. ``` - sudo chmod -R 755 ~/.lnd/ + docker cp lnd_client:/root/.lnd/ ~/.lnd ``` - Run squeaknode with authentication disabled: diff --git a/itests/generate_blocks.sh b/itests/generate_blocks.sh index fb1d1c25..509c33eb 100755 --- a/itests/generate_blocks.sh +++ b/itests/generate_blocks.sh @@ -3,8 +3,8 @@ while true; do client_address=$(docker exec -it test_lnd_client lncli --network=simnet newaddress np2wkh | jq .address -r) - MINING_ADDRESS=$client_address docker-compose up -d btcd + MINING_ADDRESS=$client_address docker compose up -d btcd echo "Mining 1 blocks to address: $client_address ..." - docker-compose run btcctl generate 400 + docker compose run btcctl generate 400 sleep 10 done diff --git a/itests/run_itest.sh b/itests/run_itest.sh index f42c298e..8a8e6122 100755 --- a/itests/run_itest.sh +++ b/itests/run_itest.sh @@ -6,16 +6,16 @@ trap "kill 0" EXIT function mine_blocks { while true; do printf "Mining 1 block to address: $MINING_ADDRESS ..." - docker-compose run btcctl generate 1 + docker compose run btcctl generate 1 sleep 1 done } cd itests -docker-compose down --volumes --remove-orphans -docker-compose build -docker-compose up -d +docker compose down --volumes --remove-orphans +docker compose build +docker compose up -d # Initialize the blockchain with miner rewards going to the test client. @@ -29,9 +29,9 @@ do sleep 2 done -MINING_ADDRESS=$client_address docker-compose up -d btcd +export MINING_ADDRESS="$client_address docker compose up -d btcd" echo "Mining 400 blocks to address: $client_address ..." -docker-compose run btcctl generate 400 +docker compose run btcctl generate 400 echo "Finished mining blocks." sleep 30 @@ -40,7 +40,7 @@ mine_blocks & echo "Background mining task is in background..." echo "Running test.sh...." -docker-compose run test ./test.sh +docker compose run test ./test.sh echo "Shutting down itest..." -# docker-compose down +# docker compose down diff --git a/itests/tests/test_squeak_node.py b/itests/tests/test_squeak_node.py index 207e17d8..642eb264 100644 --- a/itests/tests/test_squeak_node.py +++ b/itests/tests/test_squeak_node.py @@ -40,6 +40,7 @@ from tests.util import delete_squeak from tests.util import download_squeak from tests.util import download_squeak_secret_key from tests.util import free_price +from tests.util import get_balance from tests.util import get_external_address from tests.util import get_hash from tests.util import get_network @@ -607,6 +608,18 @@ def test_delete_peer(admin_stub, peer_id): def test_send_coins(admin_stub, other_admin_stub): new_address_response = admin_stub.LndNewAddress(ln.NewAddressRequest()) + get_balance_response = get_balance( + other_admin_stub, + ) + print("Get balance: {}".format(get_balance_response)) + print("--------------------") + print("--------------------") + print("--------------------") + print("--------------------") + print("--------------------") + print("--------------------") + print("--------------------") + print("--------------------", flush=True) send_coins_response = send_coins( other_admin_stub, new_address_response.address, 55555555 ) diff --git a/itests/tests/util.py b/itests/tests/util.py index ae358305..d85c3f7f 100644 --- a/itests/tests/util.py +++ b/itests/tests/util.py @@ -437,6 +437,13 @@ def disconnect_peer(node_stub, pubkey): ) +def get_balance(node_stub): + get_balance_request = lnd_pb2.WalletBalanceRequest() + return node_stub.LndWalletBalance( + get_balance_request, + ) + + def send_coins(node_stub, addr, amount): send_coins_request = lnd_pb2.SendCoinsRequest( addr=addr,