[lbry] rpcclient: allow any chain params not specified in repo already.
This commit is contained in:
parent
0dbbbaaeeb
commit
37400696ad
1 changed files with 2 additions and 17 deletions
|
@ -1185,7 +1185,7 @@ type ConnConfig struct {
|
||||||
// Params is the string representing the network that the server
|
// Params is the string representing the network that the server
|
||||||
// is running. If there is no parameter set in the config, then
|
// is running. If there is no parameter set in the config, then
|
||||||
// mainnet will be used by default.
|
// mainnet will be used by default.
|
||||||
Params string
|
Params chaincfg.Params
|
||||||
|
|
||||||
// DisableTLS specifies whether transport layer security should be
|
// DisableTLS specifies whether transport layer security should be
|
||||||
// disabled. It is recommended to always use TLS if the RPC server
|
// 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{}),
|
shutdown: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default network is mainnet, no parameters are necessary but if mainnet
|
client.chainParams = &config.Params
|
||||||
// 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
if start {
|
if start {
|
||||||
log.Infof("Established connection to RPC server %s",
|
log.Infof("Established connection to RPC server %s",
|
||||||
|
|
Loading…
Reference in a new issue