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!
|
2016-08-17 07:16:36 +02:00
|
|
|
$CLI generate 432 > /dev/null
|
2016-06-25 06:37:47 +02:00
|
|
|
if $CLI getblockchaininfo | tr -s '\012\011 ' ' ' | grep -q '"segwit": { "status": "active",'; then :
|
2016-04-12 06:47:45 +02:00
|
|
|
else
|
|
|
|
echo "Segwit not activated after 432 blocks?" >&2
|
|
|
|
$CLI getblockchaininfo >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-04-11 09:02:43 +02:00
|
|
|
else
|
2016-08-17 07:16:36 +02:00
|
|
|
$CLI generate 1 > /dev/null
|
2016-04-11 09:02:43 +02:00
|
|
|
fi
|