|
|
@ -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 |
|
|
|
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 |
|
|
@ -66,6 +65,8 @@ if [[ $1 == "close" ]]; then |
|
|
|
bitcoin-cli -regtest generate 1 |
|
|
|
fi |
|
|
|
|
|
|
|
$ELECTRUM daemon --regtest -D /tmp/alice/ -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 |
|
|
|