jam/docker/regtest/mine-block.sh
Thebora Kompanioni 707f210335
dev(regtest): update bitcoin core from v26 to v27 (#795)
* dev(regtest): use polarlightning/bitcoind docker image

* dev(regtest): update bitcoin core from v26 to v27
2024-07-19 13:56:17 +02:00

18 lines
647 B
Bash
Executable file

#!/usr/bin/env bash
set -Eeuo pipefail
die() {
local code=${2-1} # default exit status 1
echo >&2 -e "${1-}"
exit "$code"
}
BLOCKS=${1:-1} # default to mine a single block
ADDRESS=${2:-bcrt1qrnz0thqslhxu86th069r9j6y7ldkgs2tzgf5wx} # default to a "random" address
[ -z "${BLOCKS//[\-0-9]}" ] || die "Invalid parameter: 'blocks' must be an integer"
[ "$BLOCKS" -ge 1 ] || die "Invalid parameter: 'blocks' must be a positve integer"
[ -z "${ADDRESS-}" ] && die "Missing required parameter: 'address'"
docker exec -t jm_regtest_bitcoind bitcoin-cli -datadir=/home/bitcoin/data -regtest -rpcport=43782 generatetoaddress "$BLOCKS" "$ADDRESS"