lnrpc+lncli: deprecate sat_per_byte and add sat_per_vbyte

This commit deprecates/replaces the old field `sat_per_byte` with
`sat_per_vbyte`. While the old field suggests sat per byte, it’s
actually using sat per virtual byte. We use the Hidden param to hide all
the deprecated flags. These flags won't show up in help menu onwards,
while stay valid that can be passed from cli. Thus bash scripts
referencing these fields won't be broken.
This commit is contained in:
yyforyongyu
2021-03-11 08:29:50 +08:00
parent 2466758acd
commit 9d0d88ac21
20 changed files with 1519 additions and 1110 deletions

View File

@ -240,6 +240,23 @@ func extractPathArgs(ctx *cli.Context) (string, string, error) {
return tlsCertPath, macPath, nil
}
// checkNotBothSet accepts two flag names, a and b, and checks that only flag a
// or flag b can be set, but not both. It returns the name of the flag or an
// error.
func checkNotBothSet(ctx *cli.Context, a, b string) (string, error) {
if ctx.IsSet(a) && ctx.IsSet(b) {
return "", fmt.Errorf(
"either %s or %s should be set, but not both", a, b,
)
}
if ctx.IsSet(a) {
return a, nil
}
return b, nil
}
func main() {
app := cli.NewApp()
app.Name = "lncli"