From c0a1b4e2ac9f08967d710e458d25d7405cd76e39 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 21 Mar 2019 21:53:50 -0700 Subject: [PATCH] cmd/loopd: point to testnet loop server for testnet mode Fixes #20. --- cmd/loopd/config.go | 7 ++++++- cmd/loopd/daemon.go | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/loopd/config.go b/cmd/loopd/config.go index 53b82f1..cc9ba91 100644 --- a/cmd/loopd/config.go +++ b/cmd/loopd/config.go @@ -21,9 +21,14 @@ type config struct { View viewParameters `command:"view" alias:"v" description:"View all swaps in the database. This command can only be executed when loopd is not running."` } +const ( + mainnetServer = "swap.lightning.today:11009" + testnetServer = "test.swap.lightning.today:11009" +) + var defaultConfig = config{ Network: "mainnet", - SwapServer: "swap.lightning.today:11009", + SwapServer: mainnetServer, RPCListen: "localhost:11010", RESTListen: "localhost:8081", Insecure: false, diff --git a/cmd/loopd/daemon.go b/cmd/loopd/daemon.go index dd5875d..0df40ea 100644 --- a/cmd/loopd/daemon.go +++ b/cmd/loopd/daemon.go @@ -26,6 +26,12 @@ func daemon(config *config) error { } defer lnd.Close() + // If the user is targeting the testnet network, then we'll point + // towards the testnet swap server rather than the mainnet endpoint. + if config.Network == "testnet" { + config.SwapServer = testnetServer + } + swapClient, cleanup, err := getClient( config.Network, config.SwapServer, config.Insecure, &lnd.LndServices, )