haveno/docs/autosetup-regtest-dao/generate_101_blocks.sh
2021-05-04 20:20:01 -04:00

26 lines
530 B
Bash
Executable File

#!/bin/bash
function is_connected(){
sleep 1
blocks=$(bitcoin-cli -datadir=. -regtest getblockcount)
if [ $? -eq 0 ];then
echo "yes"
else
echo "no"
fi
}
connected=$(is_connected)
until [ "$connected" == "yes" ];do
connected=$(is_connected)
done
blocks=$(bitcoin-cli -datadir=. -regtest getblockcount)
if [ $? -eq 0 ] && [ $blocks -lt 101 ];then
echo "$0: found less blocks then 101, generating ..."
bitcoin-cli -datadir=. -regtest generate 101
echo "$0: done, exiting"
exit 0
fi
echo "$0: nothing to do, exiting"