diff --git a/rpcclient/infrastructure.go b/rpcclient/infrastructure.go index 798f0279..359a48d0 100644 --- a/rpcclient/infrastructure.go +++ b/rpcclient/infrastructure.go @@ -1185,7 +1185,7 @@ type ConnConfig struct { // Params is the string representing the network that the server // is running. If there is no parameter set in the config, then // mainnet will be used by default. - Params string + Params chaincfg.Params // DisableTLS specifies whether transport layer security should be // disabled. It is recommended to always use TLS if the RPC server @@ -1434,22 +1434,7 @@ func New(config *ConnConfig, ntfnHandlers *NotificationHandlers) (*Client, error shutdown: make(chan struct{}), } - // Default network is mainnet, no parameters are necessary but if mainnet - // is specified it will be the param - switch config.Params { - case "": - fallthrough - case chaincfg.MainNetParams.Name: - client.chainParams = &chaincfg.MainNetParams - case chaincfg.TestNet3Params.Name: - client.chainParams = &chaincfg.TestNet3Params - case chaincfg.RegressionNetParams.Name: - client.chainParams = &chaincfg.RegressionNetParams - case chaincfg.SimNetParams.Name: - client.chainParams = &chaincfg.SimNetParams - default: - return nil, fmt.Errorf("rpcclient.New: Unknown chain %s", config.Params) - } + client.chainParams = &config.Params if start { log.Infof("Established connection to RPC server %s",