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