33
33
defaultMaxLogSize = int64 (10 )
34
34
defaultLogsToKeep = 20
35
35
defaultVSPFee = 3.0
36
- defaultNetwork = "testnet"
36
+ defaultNetworkName = "testnet"
37
37
defaultHomeDir = dcrutil .AppDataDir (appName , false )
38
38
defaultConfigFilename = fmt .Sprintf ("%s.conf" , appName )
39
39
defaultDBFilename = fmt .Sprintf ("%s.db" , appName )
@@ -52,7 +52,7 @@ type vspdConfig struct {
52
52
LogLevel string `long:"loglevel" ini-name:"loglevel" description:"Logging level." choice:"trace" choice:"debug" choice:"info" choice:"warn" choice:"error" choice:"critical"`
53
53
MaxLogSize int64 `long:"maxlogsize" ini-name:"maxlogsize" description:"File size threshold for log file rotation (MB)."`
54
54
LogsToKeep int `long:"logstokeep" ini-name:"logstokeep" description:"The number of rotated log files to keep."`
55
- Network string `long:"network" ini-name:"network" description:"Decred network to use." choice:"testnet" choice:"mainnet" choice:"simnet"`
55
+ NetworkName string `long:"network" ini-name:"network" description:"Decred network to use." choice:"testnet" choice:"mainnet" choice:"simnet"`
56
56
VSPFee float64 `long:"vspfee" ini-name:"vspfee" description:"Fee percentage charged for VSP use. eg. 2.0 (2%), 0.5 (0.5%)."`
57
57
DcrdHost string `long:"dcrdhost" ini-name:"dcrdhost" description:"The ip:port to establish a JSON-RPC connection with dcrd. Should be the same host where vspd is running."`
58
58
DcrdUser string `long:"dcrduser" ini-name:"dcrduser" description:"Username for dcrd RPC connections."`
@@ -178,7 +178,7 @@ func loadConfig() (*vspdConfig, error) {
178
178
LogLevel : defaultLogLevel ,
179
179
MaxLogSize : defaultMaxLogSize ,
180
180
LogsToKeep : defaultLogsToKeep ,
181
- Network : defaultNetwork ,
181
+ NetworkName : defaultNetworkName ,
182
182
VSPFee : defaultVSPFee ,
183
183
HomeDir : defaultHomeDir ,
184
184
ConfigFile : defaultConfigFile ,
@@ -279,13 +279,9 @@ func loadConfig() (*vspdConfig, error) {
279
279
}
280
280
281
281
// Set the active network.
282
- switch cfg .Network {
283
- case "testnet" :
284
- cfg .network = & config .TestNet3
285
- case "mainnet" :
286
- cfg .network = & config .MainNet
287
- case "simnet" :
288
- cfg .network = & config .SimNet
282
+ cfg .network , err = config .NetworkFromName (cfg .NetworkName )
283
+ if err != nil {
284
+ return nil , err
289
285
}
290
286
291
287
// Ensure backup interval is greater than 30 seconds.
0 commit comments