From cc65f9f0990eb2fab33806ad197bbcdf44fab85b Mon Sep 17 00:00:00 2001 From: Vu Vo Date: Tue, 17 Dec 2024 21:39:41 +0700 Subject: [PATCH] makefile with prefix bitcoind and fix bitcoind docker version Signed-off-by: Vu Vo --- Makefile | 18 ++++++++++-------- contrib/MockBitcoind.md | 10 +++++++--- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 37ac0c7..3712f06 100644 --- a/Makefile +++ b/Makefile @@ -68,10 +68,12 @@ cover-html: test-unit-cover ## Infrastructure ## ############################################################################### +BITCOIND_IMAGE="kylemanna/bitcoind@sha256:2400e64960457b22be55299a2d7fa2aaa217f3dfc4afb84387e5511fe8ce5055" BITCOIND_SNAPSHOT=$(shell pwd)/contrib/snapshot BITCOIND_DATA=$(shell pwd)/contrib/regtest +WALLET="nativewallet" -run-bitcoind: +bitcoind-run: @docker run -v $(BITCOIND_DATA):/bitcoin/.bitcoin --name=bitcoind-node -d \ -p 18444:8333 \ -p 127.0.0.1:18443:8332 \ @@ -80,22 +82,22 @@ run-bitcoind: -e PRINTTOCONSOLE=1 \ -e RPCUSER=mysecretrpcuser \ -e RPCPASSWORD=mysecretrpcpassword \ - kylemanna/bitcoind - @sleep 1 - @docker exec -it bitcoind-node bitcoin-cli -regtest -rpcport=8332 loadwallet "nativewallet" + $(BITCOIND_IMAGE) + @sleep 2 + @docker exec -it bitcoind-node bitcoin-cli -regtest -rpcport=8332 loadwallet $(WALLET) -bitcoind-reinit: bitcoinregtest-snapshot bitcoind-run +bitcoind-reinit: bitcoinregtest-snapshot bitcoind-remove bitcoind-run bitcoind-start: @docker start bitcoind-node -stop-bitcoind: +bitcoind-stop: @docker stop bitcoind-node -delete-bitcoind: +bitcoind-remove: @docker rm -f bitcoind-node -restart-bitcoind: delete-bitcoind create-bitcoind +restart-bitcoind: bitcoind-remove bitcoind-run bitcoinregtest-snapshot: @rm -rf $(BITCOIND_DATA) diff --git a/contrib/MockBitcoind.md b/contrib/MockBitcoind.md index 90383dc..b19e867 100644 --- a/contrib/MockBitcoind.md +++ b/contrib/MockBitcoind.md @@ -5,25 +5,29 @@ Create a new bitcoind node with snapshot data ```bash -make create-bitcoind +make bitcoind-run ``` ## Stop bitcoind node ```bash -make stop-bitcoind +make bitcoind-stop ``` ## Start bitcoind node You can start bitcoind node again. This command will keep any state changes on the bitcoind node. +```bash +make bitcoind-start +``` + ## Restart bitcoind node Restarting bitcoind will create node with a snapshot data. ```bash -make restart-bitcoind +make bitcoind-reinit ``` ## Interact with bitcoind node