[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 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 // Exit if you try to use a simulation wallet with a standard
// data directory. // data directory.
if !(cfg.AppDataDir.ExplicitlySet() || cfg.DataDir.ExplicitlySet()) && cfg.CreateTemp { if !(cfg.AppDataDir.ExplicitlySet() || cfg.DataDir.ExplicitlySet()) {
fmt.Fprintln(os.Stderr, "Tried to create a temporary simulation "+ errMsg += ", but failed to specify data directory!"
"wallet, but failed to specify data directory!") fmt.Fprintln(os.Stderr, errMsg)
os.Exit(0) os.Exit(0)
} }
// Exit if you try to use a simulation wallet on anything other than // Exit if you try to use a simulation wallet on anything other than
// simnet or testnet3. // simnet, regtest or testnet3.
if !cfg.SimNet && cfg.CreateTemp { if !(cfg.Regtest || cfg.SimNet || cfg.TestNet3) {
fmt.Fprintln(os.Stderr, "Tried to create a temporary simulation "+ errMsg += "for network other than simnet, regtest, or testnet3"
"wallet for network other than simnet!") fmt.Fprintln(os.Stderr, errMsg)
os.Exit(0) os.Exit(0)
} }
}
// Ensure the wallet exists or create it when the create flag is set. // Ensure the wallet exists or create it when the create flag is set.
netDir := networkDir(cfg.AppDataDir.Value, activeNet.Params) netDir := networkDir(cfg.AppDataDir.Value, activeNet.Params)