From 5148397a756c13ce7fed10202af72af0bf51d35c Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 11 Mar 2019 21:00:29 +0100 Subject: [PATCH] test forwarding --- .../tests/test_forwarding/test_forwarding.sh | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/electrum/tests/test_forwarding/test_forwarding.sh b/electrum/tests/test_forwarding/test_forwarding.sh index a19b4506b..79ec242a3 100755 --- a/electrum/tests/test_forwarding/test_forwarding.sh +++ b/electrum/tests/test_forwarding/test_forwarding.sh @@ -5,8 +5,8 @@ ELECTRUM=./run_electrum if [[ $# -eq 0 ]]; then - echo "syntax: init|open|status|pay|close" - exit + echo "syntax: init|start|open|status|pay|close|stop" + exit 1 fi if [[ $1 == "init" ]]; then @@ -19,17 +19,18 @@ if [[ $1 == "init" ]]; then bitcoin-cli -regtest sendtoaddress `$ELECTRUM getunusedaddress --regtest -D /tmp/bob/` 1 bitcoin-cli -regtest sendtoaddress `$ELECTRUM getunusedaddress --regtest -D /tmp/carol/` 1 bitcoin-cli -regtest generate 1 > /dev/null - exit fi # start daemons. Bob is started first because he is listening -$ELECTRUM daemon --regtest -D /tmp/bob/ -s 127.0.0.1:51001:t start -$ELECTRUM daemon --regtest -D /tmp/bob/ load_wallet -$ELECTRUM daemon --regtest -D /tmp/alice/ -s 127.0.0.1:51001:t start -$ELECTRUM daemon --regtest -D /tmp/alice/ load_wallet -$ELECTRUM daemon --regtest -D /tmp/carol/ -s 127.0.0.1:51001:t start -$ELECTRUM daemon --regtest -D /tmp/carol/ load_wallet - +if [[ $1 == "start" ]]; then + $ELECTRUM daemon --regtest -D /tmp/bob/ -s 127.0.0.1:51001:t start + $ELECTRUM daemon --regtest -D /tmp/bob/ load_wallet + $ELECTRUM daemon --regtest -D /tmp/alice/ -s 127.0.0.1:51001:t start + $ELECTRUM daemon --regtest -D /tmp/alice/ load_wallet + $ELECTRUM daemon --regtest -D /tmp/carol/ -s 127.0.0.1:51001:t start + $ELECTRUM daemon --regtest -D /tmp/carol/ load_wallet + echo "daemons started" +fi if [[ $1 == "open" ]]; then bob_node=$($ELECTRUM --regtest -D /tmp/bob/ nodeid) @@ -51,8 +52,6 @@ if [[ $1 == "pay" ]]; then request=$($ELECTRUM --regtest -D /tmp/carol/ addinvoice 0.0001 "blah") echo $request $ELECTRUM --regtest -D /tmp/alice/ lnpay $request - # sleep before stopping nodes - sleep 3 fi if [[ $1 == "close" ]]; then @@ -65,7 +64,9 @@ if [[ $1 == "close" ]]; then echo "mining 1 block" bitcoin-cli -regtest generate 1 fi - -$ELECTRUM daemon --regtest -D /tmp/alice/ -s 127.0.0.1:51001:t stop -$ELECTRUM daemon --regtest -D /tmp/bob/ -s 127.0.0.1:51001:t stop -$ELECTRUM daemon --regtest -D /tmp/carol/ -s 127.0.0.1:51001:t stop + +if [[ $1 == "stop" ]]; then + $ELECTRUM daemon --regtest -D /tmp/bob/ -s 127.0.0.1:51001:t stop + $ELECTRUM daemon --regtest -D /tmp/alice/ -s 127.0.0.1:51001:t stop + $ELECTRUM daemon --regtest -D /tmp/carol/ -s 127.0.0.1:51001:t stop +fi