mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
daemon/test/scripts: maek slightly more general for lightningd/lightningd
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0444d68197
commit
e39d09d5a5
@ -122,12 +122,12 @@ EOF
|
||||
[ $NUM_LIGHTNINGD = 2 ] || echo port=`findport 4010 $VARIANT` >> $DIR3/config
|
||||
}
|
||||
|
||||
# Use DIR REDIR REDIRERR GDBFLAG
|
||||
# Use DIR REDIR REDIRERR GDBFLAG BINARY
|
||||
start_one_lightningd()
|
||||
{
|
||||
# Need absolute path for re-exec testing.
|
||||
local CMD
|
||||
CMD="$(readlink -f `pwd`/../lightningd) --lightning-dir=$1"
|
||||
CMD="$(readlink -f `pwd`/../../$5) --lightning-dir=$1"
|
||||
if [ -n "$4" ]; then
|
||||
echo Press return once you run: gdb --args $CMD >&2
|
||||
|
||||
@ -142,6 +142,7 @@ start_one_lightningd()
|
||||
start_lightningd()
|
||||
{
|
||||
NUM_LIGHTNINGD=$1
|
||||
BINARY=${2:-daemon/lightningd}
|
||||
|
||||
# If bitcoind not already running, start it.
|
||||
if ! $CLI getinfo >/dev/null 2>&1; then
|
||||
@ -152,9 +153,9 @@ start_lightningd()
|
||||
SHUTDOWN_BITCOIN=/bin/true
|
||||
fi
|
||||
|
||||
LIGHTNINGD1=`start_one_lightningd $DIR1 $REDIR1 $REDIRERR1 "$GDB1"`
|
||||
LIGHTNINGD2=`start_one_lightningd $DIR2 $REDIR2 $REDIRERR2 "$GDB2"`
|
||||
[ $NUM_LIGHTNINGD = 2 ] || LIGHTNINGD3=`start_one_lightningd $DIR3 $REDIR3 $REDIRERR3 "$GDB3"`
|
||||
LIGHTNINGD1=`start_one_lightningd $DIR1 $REDIR1 $REDIRERR1 "$GDB1" $BINARY`
|
||||
LIGHTNINGD2=`start_one_lightningd $DIR2 $REDIR2 $REDIRERR2 "$GDB2" $BINARY`
|
||||
[ $NUM_LIGHTNINGD = 2 ] || LIGHTNINGD3=`start_one_lightningd $DIR3 $REDIR3 $REDIRERR3 "$GDB3" $BINARY`
|
||||
|
||||
if ! check "$LCLI1 getlog 2>/dev/null | $FGREP Hello"; then
|
||||
echo Failed to start daemon 1 >&2
|
||||
@ -186,7 +187,10 @@ start_lightningd()
|
||||
|
||||
PORT2=`get_info_field "$LCLI2" port`
|
||||
[ $NUM_LIGHTNINGD = 2 ] || PORT3=`get_info_field "$LCLI3" port`
|
||||
}
|
||||
|
||||
fund_lightningd()
|
||||
{
|
||||
# Make a payment into a P2SH for anchor.
|
||||
P2SHADDR=`$LCLI1 newaddr | sed -n 's/{ "address" : "\(.*\)" }/\1/p'`
|
||||
FUND_INPUT_TXID=`$CLI sendtoaddress $P2SHADDR 0.01`
|
||||
|
@ -21,6 +21,7 @@ if [ -n "$MANUALCOMMIT" ]; then
|
||||
fi
|
||||
|
||||
start_lightningd 2
|
||||
fund_lightningd
|
||||
|
||||
# Check IDs match logs
|
||||
[ `$LCLI1 getlog | sed -n 's/.*"ID: \([0-9a-f]*\)".*/\1/p'` = $ID1 ]
|
||||
|
@ -16,6 +16,7 @@ FEE_RATE2=$(($DEFAULT_FEE_RATE2 * 5))
|
||||
echo "default-fee-rate=$DEFAULT_FEE_RATE2" >> $DIR2/config
|
||||
|
||||
start_lightningd 2
|
||||
fund_lightningd
|
||||
|
||||
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &
|
||||
|
||||
|
@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
|
||||
parse_cmdline 2 "$@"
|
||||
setup_lightning 2
|
||||
start_lightningd 2
|
||||
fund_lightningd
|
||||
|
||||
# Prevent anchor broadcast
|
||||
lcli1 dev-broadcast false
|
||||
|
@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
|
||||
parse_cmdline 2 "$@"
|
||||
setup_lightning 2
|
||||
start_lightningd 2
|
||||
fund_lightningd
|
||||
|
||||
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &
|
||||
|
||||
|
@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
|
||||
parse_cmdline 2 "$@"
|
||||
setup_lightning 2
|
||||
start_lightningd 2
|
||||
fund_lightningd
|
||||
|
||||
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &
|
||||
|
||||
|
@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
|
||||
parse_cmdline 3 "$@"
|
||||
setup_lightning 3
|
||||
start_lightningd 3
|
||||
fund_lightningd
|
||||
|
||||
# We connect 1->2->3
|
||||
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &
|
||||
|
@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
|
||||
parse_cmdline 2 "$@"
|
||||
setup_lightning 2
|
||||
start_lightningd 2
|
||||
fund_lightningd
|
||||
|
||||
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &
|
||||
|
||||
|
@ -9,6 +9,7 @@ cd `git rev-parse --show-toplevel`/daemon/test
|
||||
parse_cmdline 2 "$@"
|
||||
setup_lightning 2
|
||||
start_lightningd 2
|
||||
fund_lightningd
|
||||
|
||||
lcli1 connect localhost $PORT2 $FUND_INPUT_TX &
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user