mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-18 14:44:22 +01:00
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:
@@ -84,7 +84,7 @@ var openChannelCommand = cli.Command{
|
||||
another address.
|
||||
|
||||
One can manually set the fee to be used for the funding transaction via either
|
||||
the --conf_target or --sat_per_byte arguments. This is optional.`,
|
||||
the --conf_target or --sat_per_vbyte arguments. This is optional.`,
|
||||
ArgsUsage: "node-key local-amt push-amt",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
@@ -119,7 +119,12 @@ var openChannelCommand = cli.Command{
|
||||
"used for fee estimation",
|
||||
},
|
||||
cli.Int64Flag{
|
||||
Name: "sat_per_byte",
|
||||
Name: "sat_per_byte",
|
||||
Usage: "Deprecated, use sat_per_vbyte instead.",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.Int64Flag{
|
||||
Name: "sat_per_vbyte",
|
||||
Usage: "(optional) a manual fee expressed in " +
|
||||
"sat/vbyte that should be used when crafting " +
|
||||
"the transaction",
|
||||
@@ -214,10 +219,19 @@ func openChannel(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check that only the field sat_per_vbyte or the deprecated field
|
||||
// sat_per_byte is used.
|
||||
feeRateFlag, err := checkNotBothSet(
|
||||
ctx, "sat_per_vbyte", "sat_per_byte",
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
minConfs := int32(ctx.Uint64("min_confs"))
|
||||
req := &lnrpc.OpenChannelRequest{
|
||||
TargetConf: int32(ctx.Int64("conf_target")),
|
||||
SatPerByte: ctx.Int64("sat_per_byte"),
|
||||
SatPerVbyte: ctx.Uint64(feeRateFlag),
|
||||
MinHtlcMsat: ctx.Int64("min_htlc_msat"),
|
||||
RemoteCsvDelay: uint32(ctx.Uint64("remote_csv_delay")),
|
||||
MinConfs: minConfs,
|
||||
@@ -730,7 +744,7 @@ func checkPsbtFlags(req *lnrpc.OpenChannelRequest) error {
|
||||
return fmt.Errorf("specifying minimum confirmations for PSBT " +
|
||||
"funding is not supported")
|
||||
}
|
||||
if req.TargetConf != 0 || req.SatPerByte != 0 {
|
||||
if req.TargetConf != 0 || req.SatPerByte != 0 || req.SatPerVbyte != 0 {
|
||||
return fmt.Errorf("setting fee estimation parameters not " +
|
||||
"supported for PSBT funding")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user