2015-06-25 06:19:17 +02:00
|
|
|
#! /bin/sh
|
2015-09-30 03:24:11 +02:00
|
|
|
# Generate a block.
|
2015-06-25 06:19:17 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
. `dirname $0`/vars.sh
|
2015-06-30 05:18:06 +02:00
|
|
|
INIT=$1
|
2015-06-25 06:19:17 +02:00
|
|
|
|
2016-04-11 09:02:43 +02:00
|
|
|
# Initially we need 100 blocks so coinbase matures, giving us funds.
|
|
|
|
if [ -n "$INIT" ]; then
|
2016-04-12 06:47:45 +02:00
|
|
|
# To activate segwit via BIP9, we need at least 432 blocks!
|
|
|
|
$CLI generate 432
|
|
|
|
if $CLI getblockchaininfo | tr -s '\012\011 ' ' ' | grep -q '{ "id": "witness", "status": "active" }'; then :
|
|
|
|
else
|
|
|
|
echo "Segwit not activated after 432 blocks?" >&2
|
|
|
|
$CLI getblockchaininfo >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-04-11 09:02:43 +02:00
|
|
|
else
|
|
|
|
$CLI generate 1
|
|
|
|
fi
|