core-lightning/test-cli/scripts/generate-block.sh
Rusty Russell 454a3867e5 BIP68 support (nSequence enforcement)
The latest version of the BIP doesn't use inversion, but does use
bitshifts.

It also uncovered a bug in the test scripts: the block timestamps
creep forward when we generate large numbers of blocks (UpdateTime
insists it be > GetMedianTimePast() so it's valid).  We need to take
this into account when waiting for the median to move (reduced it from
60 to 30 seconds, since that adds about 14 seconds).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-09-30 10:54:11 +09:30

27 lines
471 B
Bash
Executable File

#! /bin/sh
# Generate a block.
set -e
. `dirname $0`/vars.sh
INIT=$1
case $STYLE in
alpha)
# This is a one-shot in alpha, it seems.
$CLI setgenerate true
# Avoid median time bug by generating 11 blocks
if [ -n "$INIT" ]; then
for i in `seq 10`; do $CLI setgenerate true; done
fi
;;
bitcoin)
# Initially we need 100 blocks so coinbase matures, giving us funds.
if [ -n "$INIT" ]; then
$CLI generate 101
else
$CLI generate 1
fi
;;
esac