2015-06-30 12:48:06 +09:30
|
|
|
#! /bin/sh -e
|
|
|
|
|
|
|
|
. `dirname $0`/vars.sh
|
|
|
|
|
2016-11-08 21:50:55 +10:30
|
|
|
VERSION=$(`dirname $0`/../../lightning-cli --version | head -n1)
|
|
|
|
[ $VERSION = `git describe --always --dirty` ] || (echo Wrong version $VERSION >&2; exit 1)
|
|
|
|
|
2015-06-30 12:48:06 +09:30
|
|
|
# Start clean
|
2016-03-15 17:08:42 +10:30
|
|
|
rm -rf $DATADIR
|
|
|
|
mkdir $DATADIR
|
|
|
|
|
2016-08-26 15:44:04 +09:30
|
|
|
# Find a free port (racy, but hey)
|
2016-11-08 21:56:55 +10:30
|
|
|
PORT=`findport 18332 $VARIANT`
|
2016-08-26 15:44:04 +09:30
|
|
|
RPCPORT=`findport $(($PORT + 1))`
|
|
|
|
|
2016-03-15 17:08:42 +10:30
|
|
|
# Create appropriate config file so cmdline matches.
|
|
|
|
cat > $DATADIR/bitcoin.conf <<EOF
|
|
|
|
regtest=1
|
|
|
|
testnet=0
|
2016-08-26 15:44:04 +09:30
|
|
|
rpcport=$RPCPORT
|
|
|
|
port=$PORT
|
2016-03-15 17:08:42 +10:30
|
|
|
EOF
|
2015-06-30 12:48:06 +09:30
|
|
|
|
|
|
|
$DAEMON &
|
|
|
|
i=0
|
|
|
|
while ! $CLI getinfo >/dev/null 2>&1; do
|
2016-11-08 21:56:55 +10:30
|
|
|
if [ $i -gt 60 ]; then
|
2015-06-30 12:48:06 +09:30
|
|
|
echo $DAEMON start failed? >&1
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
i=$(($i + 1))
|
|
|
|
done
|
2016-04-12 14:17:45 +09:30
|
|
|
|
|
|
|
# Make sure they have segwit support!
|
2016-06-25 14:07:47 +09:30
|
|
|
if $CLI getblockchaininfo | grep -q '"segwit"'; then :
|
2016-04-12 14:17:45 +09:30
|
|
|
else
|
|
|
|
echo This bitcoind does not have segwit support. >&2
|
2016-06-25 14:07:47 +09:30
|
|
|
echo Please install a recent one >&2
|
2016-04-12 14:17:45 +09:30
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-11-08 21:52:55 +10:30
|
|
|
`dirname $0`/generate-block.sh init
|
2015-06-30 12:48:06 +09:30
|
|
|
|
2016-11-10 23:30:35 +10:30
|
|
|
A1=$($CLI getnewaddress)
|
2015-09-24 15:00:47 +09:30
|
|
|
TX=`$CLI sendmany "" "{ \"$A1\":0.01 }"`
|
2016-11-08 21:52:55 +10:30
|
|
|
`dirname $0`/generate-block.sh
|