Skip to content

Commit ec40647

Browse files
authored
Merge pull request #25 from Roasbeef/testnet-server
cmd/loopd: point to testnet loop server for testnet mode
2 parents e14e7e9 + b9b52c9 commit ec40647

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,17 @@ After you have lnd and the Loop client installed, you can execute a Loop swap.
105105
The Loop client needs its own short-lived daemon which will deal with the swaps
106106
in progress.
107107

108-
To run this:
108+
Command to start `loopd`::
109109

110110
```
111-
`loopd`
111+
loopd
112112
113113
// Or if you want to do everything in the same terminal and background loopd
114-
`loopd &`
114+
loopd &
115+
116+
// For testnet mode, you'll need to specify the network as mainnet is the
117+
default:
118+
loopd --network=testnet
115119
```
116120

117121
By default `loopd` attempts to connect to the lnd instance running on

cmd/loopd/config.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ type config struct {
2121
View viewParameters `command:"view" alias:"v" description:"View all swaps in the database. This command can only be executed when loopd is not running."`
2222
}
2323

24+
const (
25+
mainnetServer = "swap.lightning.today:11009"
26+
testnetServer = "test.swap.lightning.today:11009"
27+
)
28+
2429
var defaultConfig = config{
2530
Network: "mainnet",
26-
SwapServer: "swap.lightning.today:11009",
31+
SwapServer: mainnetServer,
2732
RPCListen: "localhost:11010",
2833
RESTListen: "localhost:8081",
2934
Insecure: false,

cmd/loopd/daemon.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ func daemon(config *config) error {
2626
}
2727
defer lnd.Close()
2828

29+
// If the user is targeting the testnet network, then we'll point
30+
// towards the testnet swap server rather than the mainnet endpoint.
31+
if config.Network == "testnet" {
32+
config.SwapServer = testnetServer
33+
}
34+
2935
swapClient, cleanup, err := getClient(
3036
config.Network, config.SwapServer, config.Insecure, &lnd.LndServices,
3137
)

0 commit comments

Comments
 (0)