[lbry] enable regtest for --createtemp (temporary wallet)

This commit is contained in:
Roy Lee 2021-11-08 21:29:47 -08:00
parent f52bea1e37
commit d6434b148a

View file

@ -442,21 +442,24 @@ func loadConfig() (*config, []string, error) {
return nil, nil, err
}
if cfg.CreateTemp {
errMsg := "Tried to create a temporary simulation wallet"
// Exit if you try to use a simulation wallet with a standard
// data directory.
if !(cfg.AppDataDir.ExplicitlySet() || cfg.DataDir.ExplicitlySet()) && cfg.CreateTemp {
fmt.Fprintln(os.Stderr, "Tried to create a temporary simulation "+
"wallet, but failed to specify data directory!")
if !(cfg.AppDataDir.ExplicitlySet() || cfg.DataDir.ExplicitlySet()) {
errMsg += ", but failed to specify data directory!"
fmt.Fprintln(os.Stderr, errMsg)
os.Exit(0)
}
// Exit if you try to use a simulation wallet on anything other than
// simnet or testnet3.
if !cfg.SimNet && cfg.CreateTemp {
fmt.Fprintln(os.Stderr, "Tried to create a temporary simulation "+
"wallet for network other than simnet!")
// simnet, regtest or testnet3.
if !(cfg.Regtest || cfg.SimNet || cfg.TestNet3) {
errMsg += "for network other than simnet, regtest, or testnet3"
fmt.Fprintln(os.Stderr, errMsg)
os.Exit(0)
}
}
// Ensure the wallet exists or create it when the create flag is set.
netDir := networkDir(cfg.AppDataDir.Value, activeNet.Params)