File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,6 +64,14 @@ Test that all nodes are properly connected with this command
6464./igniter.sh build
6565```
6666
67+ ### Connect to all peers
68+
69+ Test that all peers are up and your node can connect with this command
70+
71+ ``` bash
72+ ./igniter.sh connect
73+ ```
74+
6775### Route the payment
6876
6977All that's left to do is to execute the script with this command
Original file line number Diff line number Diff line change @@ -35,6 +35,25 @@ build () {
3535 $LNCLI buildroute --amt ${AMOUNT} --hops ${HOPS} --outgoing_chan_id ${OUTGOING_CHAN_ID}
3636}
3737
38+ # Arg option: 'connect'
39+ connect () {
40+ IFS=,
41+ PEERS=$( $LNCLI listpeers | grep pub_key | tr ' "' ' ' | awk ' {print $3}' )
42+ SELF=$( $LNCLI getinfo | grep pubkey | tr ' "' ' ' | head -n 1 | awk ' {print $3}' )
43+ for KEY in $HOPS
44+ do
45+ if [[ " $PEERS " =~ " $KEY " ]]; then
46+ echo " Already connected to: $KEY "
47+ else
48+ if [ " $SELF " != " $KEY " ] ; then
49+ ADDRESS=$( $LNCLI getnodeinfo $KEY | grep \" addr\" | head -n 1| awk ' {print $2}' | sed ' s/"//g' )
50+ echo " Connecting to: $KEY @$ADDRESS "
51+ $LNCLI connect $KEY @$ADDRESS
52+ fi
53+ fi
54+ done
55+ }
56+
3857# Arg option: 'send'
3958send () {
4059 INVOICE=$( $LNCLI addinvoice --amt=${AMOUNT} --memo=" Rebalancing..." )
@@ -76,13 +95,14 @@ assert_tools () {
7695# Arg option: '--help'
7796help () {
7897 cat << EOF
79- usage: ./igniter.sh [--help] [build] [send]
98+ usage: ./igniter.sh [--help] [build] [connect] [ send]
8099 <command> [<args>]
81100
82101Open the script and configure values first. Then run
83102the script with one of the following flags:
84103
85- build Build the routes for the configured nodes
104+ build Build the routes for the configured node
105+ connect Connect to every peer with lncli
86106 send Build route and send payment along route
87107
88108EOF
@@ -99,6 +119,9 @@ case $1 in
99119 " build" )
100120 build $rest_args
101121 ;;
122+ " connect" )
123+ connect $rest_args
124+ ;;
102125 " send" )
103126 send $rest_args
104127 ;;
You can’t perform that action at this time.
0 commit comments