lnd+lncfg: move normalizeNetwork to lncfg

This commit is contained in:
Eugene
2020-10-06 11:17:14 -07:00
committed by eugene
parent 4d238cfa2f
commit 46ef212de4
4 changed files with 17 additions and 18 deletions

View File

@@ -87,3 +87,13 @@ func CleanAndExpandPath(path string) string {
// but the variables can still be expanded via POSIX-style $VARIABLE.
return filepath.Clean(os.ExpandEnv(path))
}
// NormalizeNetwork returns the common name of a network type used to create
// file paths. This allows differently versioned networks to use the same path.
func NormalizeNetwork(network string) string {
if strings.HasPrefix(network, "testnet") {
return "testnet"
}
return network
}