From 37400696ad50fd7d3d40e78986a1bd2d9d025bed Mon Sep 17 00:00:00 2001 From: Mark Beamer Jr Date: Mon, 3 Feb 2020 00:04:10 -0500 Subject: [PATCH] [lbry] rpcclient: allow any chain params not specified in repo already. --- rpcclient/infrastructure.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) 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",