mirror of
https://github.com/lightninglabs/loop
synced 2024-11-11 13:11:12 +00:00
loopd: use proper default swap server address
This commit fixes the bug that caused running loopd on testnet to connect to the mainnet swap server.
This commit is contained in:
parent
56ab811f62
commit
ca3cfc1431
@ -28,7 +28,6 @@ const (
|
|||||||
|
|
||||||
var defaultConfig = config{
|
var defaultConfig = config{
|
||||||
Network: "mainnet",
|
Network: "mainnet",
|
||||||
SwapServer: mainnetServer,
|
|
||||||
RPCListen: "localhost:11010",
|
RPCListen: "localhost:11010",
|
||||||
RESTListen: "localhost:8081",
|
RESTListen: "localhost:8081",
|
||||||
Insecure: false,
|
Insecure: false,
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -26,12 +27,20 @@ func daemon(config *config) error {
|
|||||||
}
|
}
|
||||||
defer lnd.Close()
|
defer lnd.Close()
|
||||||
|
|
||||||
// If the user is targeting the testnet network, and they haven't
|
// If no swap server is specified, use the default addresses for mainnet
|
||||||
// specified new swap server, then we'll point towards the testnet swap
|
// and testnet.
|
||||||
// server rather than the mainnet endpoint.
|
if config.SwapServer == "" {
|
||||||
if config.Network == "testnet" && config.SwapServer == "" {
|
switch config.Network {
|
||||||
|
case "mainnet":
|
||||||
|
config.SwapServer = mainnetServer
|
||||||
|
case "testnet":
|
||||||
config.SwapServer = testnetServer
|
config.SwapServer = testnetServer
|
||||||
|
default:
|
||||||
|
return errors.New("no swap server address specified")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Infof("Swap server address: %v", config.SwapServer)
|
||||||
|
|
||||||
// Create an instance of the loop client library.
|
// Create an instance of the loop client library.
|
||||||
swapClient, cleanup, err := getClient(
|
swapClient, cleanup, err := getClient(
|
||||||
|
Loading…
Reference in New Issue
Block a user