mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
scripts/setup.sh: setup helper script.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
783aa35aa6
commit
27e7c7b986
@ -4,6 +4,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
. `dirname $0`/vars.sh
|
. `dirname $0`/vars.sh
|
||||||
|
INIT=$1
|
||||||
|
|
||||||
case $STYLE in
|
case $STYLE in
|
||||||
alpha)
|
alpha)
|
||||||
@ -11,6 +12,11 @@ case $STYLE in
|
|||||||
$CLI setgenerate true
|
$CLI setgenerate true
|
||||||
;;
|
;;
|
||||||
bitcoin)
|
bitcoin)
|
||||||
$CLI generate 1
|
# Initially we need 100 blocks so coinbase matures, giving us funds.
|
||||||
|
if [ -n "$INIT" ]; then
|
||||||
|
$CLI generate 101
|
||||||
|
else
|
||||||
|
$CLI generate 1
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
34
test-cli/scripts/setup.sh
Executable file
34
test-cli/scripts/setup.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#! /bin/sh -e
|
||||||
|
|
||||||
|
. `dirname $0`/vars.sh
|
||||||
|
|
||||||
|
if $CLI getinfo 2>/dev/null; then
|
||||||
|
echo $DAEMON already running >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start clean
|
||||||
|
rm -rf $DATADIR/$REGTESTDIR
|
||||||
|
|
||||||
|
$DAEMON &
|
||||||
|
i=0
|
||||||
|
while ! $CLI getinfo >/dev/null 2>&1; do
|
||||||
|
if [ $i -gt 30 ]; then
|
||||||
|
echo $DAEMON start failed? >&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
i=$(($i + 1))
|
||||||
|
done
|
||||||
|
|
||||||
|
scripts/generate-block.sh init
|
||||||
|
|
||||||
|
A1=`scripts/get-new-address.sh`
|
||||||
|
A2=`scripts/get-new-address.sh`
|
||||||
|
TX=`$CLI sendmany "" "{ \"$A1\":10, \"$A2\":10 }"`
|
||||||
|
scripts/generate-block.sh
|
||||||
|
|
||||||
|
# Find the inputs numbers corresponding to those 10 btc outs
|
||||||
|
echo "Arguments to test.sh:"
|
||||||
|
for i in $(seq 1 $($CLI listunspent | grep -c txid) ); do scripts/getinput.sh $i | grep -q "$TX.*/1000000000/" && echo -n "$i "; done
|
||||||
|
echo
|
@ -1,7 +1,14 @@
|
|||||||
# Sourced by other scripts
|
# Sourced by other scripts
|
||||||
CLI="bitcoin-cli -regtest"
|
|
||||||
STYLE=bitcoin
|
STYLE=bitcoin
|
||||||
#CLI="alpha-cli -regtest -testnet=0"
|
CLI="bitcoin-cli -regtest"
|
||||||
|
DATADIR=$HOME/.bitcoin
|
||||||
|
REGTESTDIR=regtest
|
||||||
|
DAEMON=bitcoind
|
||||||
|
|
||||||
#STYLE=alpha
|
#STYLE=alpha
|
||||||
|
#DATADIR=$HOME/.alpha
|
||||||
|
#REGTESTDIR=alpharegtest
|
||||||
|
#CLI="alpha-cli -datadir=$DATADIR -regtest -testnet=0"
|
||||||
|
#DAEMON="alphad -datadir=$DATADIR"
|
||||||
|
|
||||||
#PREFIX="valgrind --vgdb-error=1"
|
#PREFIX="valgrind --vgdb-error=1"
|
||||||
|
Loading…
Reference in New Issue
Block a user