Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions cmd/commands/cmd_open_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ var openChannelCommand = cli.Command{
"transaction *should* confirm in, will be " +
"used for fee estimation",
},
cli.Int64Flag{
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 " +
Expand Down Expand Up @@ -319,19 +314,10 @@ 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")),
SatPerVbyte: ctx.Uint64(feeRateFlag),
SatPerVbyte: ctx.Uint64("sat_per_vbyte"),
MinHtlcMsat: ctx.Int64("min_htlc_msat"),
RemoteCsvDelay: uint32(ctx.Uint64("remote_csv_delay")),
MinConfs: minConfs,
Expand Down Expand Up @@ -1080,7 +1066,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 || req.SatPerVbyte != 0 { // nolint:staticcheck
if req.TargetConf != 0 || req.SatPerVbyte != 0 {
return fmt.Errorf("setting fee estimation parameters not " +
"supported for PSBT funding")
}
Expand Down
72 changes: 8 additions & 64 deletions cmd/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,6 @@ var sendCoinsCommand = cli.Command{
"transaction *should* confirm in, will be " +
"used for fee estimation",
},
cli.Int64Flag{
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 " +
Expand Down Expand Up @@ -555,18 +550,9 @@ func sendCoins(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
}

// Only fee rate flag or conf_target should be set, not both.
// Check that only one is set sat_per_vbyte or conf_target, not both.
if _, err := checkNotBothSet(
ctx, feeRateFlag, "conf_target",
ctx, "sat_per_vbyte", "conf_target",
); err != nil {
return err
}
Expand Down Expand Up @@ -675,7 +661,7 @@ func sendCoins(ctx *cli.Context) error {
Addr: addr,
Amount: amt,
TargetConf: int32(ctx.Int64("conf_target")),
SatPerVbyte: ctx.Uint64(feeRateFlag),
SatPerVbyte: ctx.Uint64("sat_per_vbyte"),
SendAll: ctx.Bool("sweepall"),
Label: ctx.String(txLabelFlag.Name),
MinConfs: minConfs,
Expand Down Expand Up @@ -836,11 +822,6 @@ var sendManyCommand = cli.Command{
Usage: "(optional) the number of blocks that the transaction *should* " +
"confirm in, will be used for fee estimation",
},
cli.Int64Flag{
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 " +
Expand Down Expand Up @@ -869,18 +850,9 @@ func sendMany(ctx *cli.Context) error {
return err
}

// 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
}

// Only fee rate flag or conf_target should be set, not both.
// Check that only one is set sat_per_vbyte or conf_target, not both.
if _, err := checkNotBothSet(
ctx, feeRateFlag, "conf_target",
ctx, "sat_per_vbyte", "conf_target",
); err != nil {
return err
}
Expand All @@ -897,7 +869,7 @@ func sendMany(ctx *cli.Context) error {
txid, err := client.SendMany(ctxc, &lnrpc.SendManyRequest{
AddrToAmount: amountToAddr,
TargetConf: int32(ctx.Int64("conf_target")),
SatPerVbyte: ctx.Uint64(feeRateFlag),
SatPerVbyte: ctx.Uint64("sat_per_vbyte"),
Label: ctx.String(txLabelFlag.Name),
MinConfs: minConfs,
SpendUnconfirmed: minConfs == 0,
Expand Down Expand Up @@ -1087,11 +1059,6 @@ var closeChannelCommand = cli.Command{
"then the conf-target value set in the main " +
"lnd config will be used.",
},
cli.Int64Flag{
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 " +
Expand Down Expand Up @@ -1129,15 +1096,6 @@ func closeChannel(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
}

channelPoint, err := parseChannelPoint(ctx)
if err != nil {
return err
Expand All @@ -1148,7 +1106,7 @@ func closeChannel(ctx *cli.Context) error {
ChannelPoint: channelPoint,
Force: ctx.Bool("force"),
TargetConf: int32(ctx.Int64("conf_target")),
SatPerVbyte: ctx.Uint64(feeRateFlag),
SatPerVbyte: ctx.Uint64("sat_per_vbyte"),
DeliveryAddress: ctx.String("delivery_addr"),
MaxFeePerVbyte: ctx.Uint64("max_fee_rate"),
// This makes sure that a coop close will also be executed if
Expand Down Expand Up @@ -1291,11 +1249,6 @@ var closeAllChannelsCommand = cli.Command{
"closing transactions *should* confirm in, will be " +
"used for fee estimation",
},
cli.Int64Flag{
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 " +
Expand All @@ -1316,15 +1269,6 @@ func closeAllChannels(ctx *cli.Context) error {
client, cleanUp := getClient(ctx)
defer cleanUp()

// 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
}

prompt := "Do you really want to close ALL channels? (yes/no): "
if !ctx.Bool("skip_confirmation") && !promptForConfirmation(prompt) {
return errors.New("action aborted by user")
Expand Down Expand Up @@ -1458,7 +1402,7 @@ func closeAllChannels(ctx *cli.Context) error {
},
Force: !channel.GetActive(),
TargetConf: int32(ctx.Int64("conf_target")),
SatPerVbyte: ctx.Uint64(feeRateFlag),
SatPerVbyte: ctx.Uint64("sat_per_vbyte"),
}

txidChan := make(chan string, 1)
Expand Down
20 changes: 0 additions & 20 deletions cmd/commands/walletrpc_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,6 @@ var bumpFeeCommand = cli.Command{
can be specified and LND will query its fee estimator for the current
fee rate for the given target.`,
},
cli.Uint64Flag{
Name: "sat_per_byte",
Usage: "Deprecated, use sat_per_vbyte instead.",
Hidden: true,
},
cli.BoolFlag{
Name: "force",
Usage: "Deprecated, use immediate instead.",
Expand Down Expand Up @@ -394,11 +389,6 @@ var bumpCloseFeeCommand = cli.Command{
can be specified and LND will query its fee estimator for the current
fee rate for the given target.`,
},
cli.Uint64Flag{
Name: "sat_per_byte",
Usage: "Deprecated, use sat_per_vbyte instead.",
Hidden: true,
},
cli.BoolFlag{
Name: "force",
Usage: "Deprecated, use immediate instead.",
Expand Down Expand Up @@ -460,11 +450,6 @@ var bumpForceCloseFeeCommand = cli.Command{
be spent within to bump the closing transaction. When the deadline is
reached, ALL the budget will be spent as fees.`,
},
cli.Uint64Flag{
Name: "sat_per_byte",
Usage: "Deprecated, use sat_per_vbyte instead.",
Hidden: true,
},
cli.Uint64Flag{
Name: "sat_per_vbyte",
Usage: `
Expand Down Expand Up @@ -516,11 +501,6 @@ func bumpForceCloseFee(ctx *cli.Context) error {
return err
}

// `sat_per_byte` was deprecated we only use sats/vbyte now.
if ctx.IsSet("sat_per_byte") {
return fmt.Errorf("deprecated, use sat_per_vbyte instead")
}

// Retrieve pending sweeps.
walletClient, cleanUp := getWalletClient(ctx)
defer cleanUp()
Expand Down
15 changes: 15 additions & 0 deletions docs/release-notes/release-notes-0.22.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@

## Breaking Changes

* The deprecated fee rate option `--sat_per_byte` was removed
[PR#10889](https://github.com/lightningnetwork/lnd/pull/10889)

The following RPCs were impacted:

| RPC Method | Messages | Removed Option |
|----------------------|----------------|-------------|
| [`lnrpc.CloseChannel`](https://lightning.engineering/api-docs/api/lnd/lightning/close-channel/) | [`lnrpc.CloseChannelRequest`](https://lightning.engineering/api-docs/api/lnd/lightning/close-channel/#lnrpcclosechannelrequest) | sat_per_byte
| [`lnrpc.OpenChannelSync`](https://lightning.engineering/api-docs/api/lnd/lightning/open-channel-sync/) | [`lnrpc.OpenChannelRequest`](https://lightning.engineering/api-docs/api/lnd/lightning/open-channel-sync/#lnrpcopenchannelrequest) | sat_per_byte
| [`lnrpc.OpenChannel`](https://lightning.engineering/api-docs/api/lnd/lightning/open-channel/) | [`lnrpc.OpenChannelRequest`](https://lightning.engineering/api-docs/api/lnd/lightning/open-channel/#lnrpcopenchannelrequest) | sat_per_byte
| [`lnrpc.SendCoins`](https://lightning.engineering/api-docs/api/lnd/lightning/send-coins/) | [`lnrpc.SendCoinsRequest`](https://lightning.engineering/api-docs/api/lnd/lightning/send-coins/#lnrpcsendcoinsrequest) | sat_per_byte
| [`lnrpc.SendMany`](https://lightning.engineering/api-docs/api/lnd/lightning/send-many/) | [`lnrpc.SendManyRequest`](https://lightning.engineering/api-docs/api/lnd/lightning/send-many/#lnrpcsendmanyrequest) | sat_per_byte
| [`walletrpc.BumpFee`](https://lightning.engineering/api-docs/api/lnd/wallet-kit/bump-fee/) | [`walletrpc.BumpFeeRequest`](https://lightning.engineering/api-docs/api/lnd/wallet-kit/bump-fee/#walletrpcbumpfeerequest) | sat_per_byte

## Performance Improvements

## Deprecations
Expand Down Expand Up @@ -89,3 +103,4 @@

* Boris Nagaev
* Erick Cestari
* Pins
18 changes: 9 additions & 9 deletions itest/lnd_wallet_import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ func runWalletImportAccountScenario(ht *lntest.HarnessTest,
// balance updates accordingly.
alice := ht.NewNodeWithCoins("Alice", nil)
req := &lnrpc.SendCoinsRequest{
Addr: externalAddr,
Amount: utxoAmt,
SatPerByte: 1,
Addr: externalAddr,
Amount: utxoAmt,
SatPerVbyte: 1,
}
alice.RPC.SendCoins(req)

Expand Down Expand Up @@ -599,9 +599,9 @@ func runWalletImportAccountScenario(ht *lntest.HarnessTest,
// Send coins to Carol's address and confirm them, making sure the
// balance updates accordingly.
req = &lnrpc.SendCoinsRequest{
Addr: externalAddr,
Amount: utxoAmt,
SatPerByte: 1,
Addr: externalAddr,
Amount: utxoAmt,
SatPerVbyte: 1,
}
alice.RPC.SendCoins(req)

Expand Down Expand Up @@ -739,9 +739,9 @@ func testWalletImportPubKeyScenario(ht *lntest.HarnessTest,
// Send coins to Carol's address and confirm them, making sure
// the balance updates accordingly.
req := &lnrpc.SendCoinsRequest{
Addr: carolAddrResp.Address,
Amount: utxoAmt,
SatPerByte: 1,
Addr: carolAddrResp.Address,
Amount: utxoAmt,
SatPerVbyte: 1,
}
alice.RPC.SendCoins(req)

Expand Down
26 changes: 8 additions & 18 deletions lnrpc/rpc_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package lnrpc
import (
"encoding/hex"
"errors"
"fmt"
"sort"

"github.com/btcsuite/btcd/chaincfg/chainhash"
Expand Down Expand Up @@ -55,6 +54,12 @@ var (
RESTJsonUnmarshalOpts = &protojson.UnmarshalOptions{
AllowPartial: false,
}

// ErrSatPerByteRemoved is returned when a request still sets the
// deprecated sat_per_byte field. The field was deprecated in v0.13.0
// in favor of sat_per_vbyte and is no longer honored.
ErrSatPerByteRemoved = errors.New("sat_per_byte is no longer " +
"supported, use sat_per_vbyte instead")
)

// RPCTransaction returns a rpc transaction.
Expand Down Expand Up @@ -227,28 +232,13 @@ func GetChannelOutPoint(chanPoint *ChannelPoint) (*OutPoint, error) {
}, nil
}

// CalculateFeeRate uses either satPerByte or satPerVByte, but not both, from a
// request to calculate the fee rate. It provides compatibility for the
// deprecated field, satPerByte. Once the field is safe to be removed, the
// check can then be deleted.
func CalculateFeeRate(satPerByte, satPerVByte uint64, targetConf uint32,
// CalculateFeeRate uses satPerVByte from a request to calculate the fee rate.
func CalculateFeeRate(satPerVByte uint64, targetConf uint32,
estimator chainfee.Estimator) (chainfee.SatPerKWeight, error) {

var feeRate chainfee.SatPerKWeight

// We only allow using either the deprecated field or the new field.
if satPerByte != 0 && satPerVByte != 0 {
return feeRate, fmt.Errorf("either SatPerByte or " +
"SatPerVByte should be set, but not both")
}

// Default to satPerVByte, and overwrite it if satPerByte is set.
satPerKw := chainfee.SatPerKVByte(satPerVByte * 1000).FeePerKWeight()
if satPerByte != 0 {
satPerKw = chainfee.SatPerKVByte(
satPerByte * 1000,
).FeePerKWeight()
}

// Based on the passed fee related parameters, we'll determine an
// appropriate fee rate for this transaction.
Expand Down
17 changes: 5 additions & 12 deletions lnrpc/walletrpc/walletkit_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,19 +968,12 @@ func validateBumpFeeRequest(in *BumpFeeRequest, estimator chainfee.Estimator) (
// Get the specified fee rate if set.
satPerKwOpt := fn.None[chainfee.SatPerKWeight]()

// We only allow using either the deprecated field or the new field.
switch {
case in.SatPerByte != 0 && in.SatPerVbyte != 0:
return satPerKwOpt, false, fmt.Errorf("either SatPerByte or " +
"SatPerVbyte should be set, but not both")

case in.SatPerByte != 0:
satPerKw := chainfee.SatPerVByte(
in.SatPerByte,
).FeePerKWeight()
satPerKwOpt = fn.Some(satPerKw)
// The deprecated sat_per_byte field is no longer honored.
if in.SatPerByte != 0 {
return satPerKwOpt, false, lnrpc.ErrSatPerByteRemoved
}

case in.SatPerVbyte != 0:
if in.SatPerVbyte != 0 {
satPerKw := chainfee.SatPerVByte(
in.SatPerVbyte,
).FeePerKWeight()
Expand Down
Loading
Loading