-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart-lnd-testnet.sh
executable file
·64 lines (53 loc) · 1.55 KB
/
start-lnd-testnet.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# exit from script if error was raised.
set -e
# error function is used within a bash function in order to send the error
# message directly to the stderr output and exit.
error() {
echo "$1" > /dev/stderr
exit 0
}
# return is used within bash function in order to return the value.
return() {
echo "$1"
}
# set_default function gives the ability to move the setting of default
# env variable from docker file to the script thereby giving the ability to the
# user override it durin container start.
set_default() {
# docker initialized env variables with blank string and we can't just
# use -z flag as usually.
BLANK_STRING='""'
VARIABLE="$1"
DEFAULT="$2"
if [[ -z "$VARIABLE" || "$VARIABLE" == "$BLANK_STRING" ]]; then
if [ -z "$DEFAULT" ]; then
error "You should specify default variable"
else
VARIABLE="$DEFAULT"
fi
fi
return "$VARIABLE"
}
# Set default variables if needed.
DEBUG=$(set_default "$DEBUG" "info")
NETWORK=$(set_default "$NETWORK" "testnet")
CHAIN=$(set_default "$CHAIN" "bitcoin")
BACKEND="btcd"
if [[ "$CHAIN" == "litecoin" ]]; then
BACKEND="ltcd"
fi
# ./kill-lnd.sh &
# For testnet test usage only
exec lnd \
--logdir="/data" \
--rpclisten="0.0.0.0:10009" \
--restlisten="0.0.0.0:8080" \
--tlsextraip="0.0.0.0" \
"--$CHAIN.active" \
"--$CHAIN.$NETWORK" \
"--$CHAIN.node"="neutrino" \
"--neutrino.connect"="testnetwallet.lightningpeach.com" \
--debuglevel="$DEBUG" \
--maxpendingchannels="5" \
"$@"