2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-09 19:10:47 +00:00
loop/swap/net.go
2019-03-06 20:34:00 -08:00

28 lines
528 B
Go

package swap
import (
"errors"
"github.com/btcsuite/btcd/chaincfg"
)
// ChainParamsFromNetwork returns chain parameters based on a network name.
func ChainParamsFromNetwork(network string) (*chaincfg.Params, error) {
switch network {
case "mainnet":
return &chaincfg.MainNetParams, nil
case "testnet":
return &chaincfg.TestNet3Params, nil
case "regtest":
return &chaincfg.RegressionNetParams, nil
case "simnet":
return &chaincfg.SimNetParams, nil
default:
return nil, errors.New("unknown network")
}
}