Skip to content

Remove deprecated fee rate option --sat_per_byte#10889

Open
MPins wants to merge 4 commits into
lightningnetwork:masterfrom
MPins:remove_deprecated_sat_per_byte
Open

Remove deprecated fee rate option --sat_per_byte#10889
MPins wants to merge 4 commits into
lightningnetwork:masterfrom
MPins:remove_deprecated_sat_per_byte

Conversation

@MPins

@MPins MPins commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

As defined at release doc v0.21.0 we now remove the option --sat_per_byte.

Change Description

The sat_per_byte field was deprecated back in v0.13.0 in favor of sat_per_vbyte. This PR completes its removal: the deprecated field is no longer honored by the RPC server, the CLI, or the wallet RPC, and any request that still sets it is now explicitly rejected.

Behavior change

Previously, sat_per_byte was still accepted and silently converted, with a guard preventing both fields from being set at once.

Now, if a request sets sat_per_byte the ErrSatPerByteRemoved is returned.

@github-actions github-actions Bot added the severity-critical Requires expert review - security/consensus critical label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🔴 PR Severity: CRITICAL

Highest-severity file determines label | 7 non-test files | ~225 lines changed

🔴 Critical (1 file)
  • rpcserver.go - Core server coordination file; listed explicitly as CRITICAL in classification rules
🟠 High (2 files)
  • lnrpc/rpc_utils.go - RPC/API utility code
  • lnrpc/walletrpc/walletkit_server.go - RPC/API wallet kit server implementation
🟡 Medium (3 files)
  • cmd/commands/cmd_open_channel.go - CLI client command (cmd/* -> MEDIUM regardless of filename keywords)
  • cmd/commands/commands.go - CLI client commands
  • cmd/commands/walletrpc_active.go - CLI client walletrpc command (MEDIUM, not HIGH -- under cmd/*)
🟢 Low / Excluded (4 files)
  • docs/release-notes/release-notes-0.22.0.md - Release notes (docs/*)
  • itest/lnd_wallet_import_test.go - Integration test (excluded from severity count)
  • lnrpc/walletrpc/walletkit_server_test.go - Test file (excluded from severity count)
  • rpcserver_test.go - Test file (excluded from severity count)

Analysis

This PR touches rpcserver.go, the core server coordination file, which is explicitly listed as a CRITICAL-tier file requiring expert review. The PR also modifies RPC/API layer files under lnrpc/ (HIGH) and CLI client commands under cmd/ (MEDIUM).

Severity bump rules were checked:

  • File count: 7 non-test/non-generated files (threshold: >20) -- no bump
  • Lines changed: ~225 (threshold: >500) -- no bump
  • Multiple distinct critical packages: Only one critical file (rpcserver.go) -- no bump

The CRITICAL classification stands based on the presence of rpcserver.go alone.


To override, add a severity-override-{critical,high,medium,low} label.
<!-- pr-severity-bot -->

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request finalizes the removal of the deprecated sat_per_byte field, which has been superseded by sat_per_vbyte. By enforcing this change at the RPC and CLI layers, the codebase is simplified and technical debt is reduced. The implementation ensures that any legacy usage is now explicitly rejected, maintaining consistency across the API.

Highlights

  • Removal of Deprecated Field: The sat_per_byte field, deprecated since v0.13.0, has been completely removed from the CLI, RPC server, and wallet RPC interfaces.
  • Explicit Rejection: Requests that still include the sat_per_byte field are now explicitly rejected with the lnrpc.ErrSatPerByteRemoved error.
  • Codebase Cleanup: Removed redundant validation logic, simplified helper functions like CalculateFeeRate, and cleaned up CLI flags across multiple commands.
  • Test and Documentation Updates: Updated integration and unit tests to use sat_per_vbyte and added a breaking change entry to the release notes.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the deprecated --sat_per_byte fee rate option across multiple CLI commands and RPCs (including CloseChannel, OpenChannel, SendCoins, SendMany, and BumpFee) in favor of sat_per_vbyte. It also updates the corresponding tests and release notes. The review feedback identifies a broken markdown link in the release notes that needs to be corrected.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread docs/release-notes/release-notes-0.22.0.md Outdated
@MPins MPins changed the title Remove deprecated sat per byte Remove deprecated sat_per_byte field Jun 9, 2026
@MPins MPins changed the title Remove deprecated sat_per_byte field Remove deprecated fee rate option --sat_per_byte Jun 9, 2026
@saubyk saubyk added this to lnd v0.22 Jun 9, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in lnd v0.22 Jun 9, 2026
@saubyk saubyk moved this from Backlog to In progress in lnd v0.22 Jun 9, 2026
@saubyk saubyk added this to the v0.22.0 milestone Jun 9, 2026
@MPins
MPins force-pushed the remove_deprecated_sat_per_byte branch 2 times, most recently from ff14956 to 0207a05 Compare June 9, 2026 18:23
@saubyk
saubyk self-requested a review July 9, 2026 17:13
@saubyk

saubyk commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

/gateway review

@lightninglabs-gateway

lightninglabs-gateway Bot commented Jul 9, 2026

Copy link
Copy Markdown

✅ Review posted: #10889 (review)

1 finding(s); 1 inline, 0 in body.

🔁 Need a re-review after pushing changes? Reply with /gateway re-review.
Maintainers can also /gateway dismiss <id> to silence specific findings, or anyone can /gateway explain <id> for elaboration.

@lightninglabs-gateway lightninglabs-gateway Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR completes the removal of the deprecated sat_per_byte fee-rate field: the CLI flags are dropped, CalculateFeeRate/maybeUseDefaultConf are simplified to sat_per_vbyte only, and every RPC handler that previously honored the field (SendCoins, SendMany, parseOpenChannelReq, CloseChannel, validateBumpFeeRequest) now rejects a non-zero SatPerByte with ErrSatPerByteRemoved. The intent and behavior change are clearly documented in the release notes.

The change is correct and consistent. Each rejection is placed before any server state is dereferenced, which the new rpcserver_test.go and walletkit_server_test.go tests exercise with zero-value/nil fixtures. The removal of SatPerByte from the internal guards in checkPsbtFlags and newPsbtAssembler is safe because those paths sit behind the early rejection in parseOpenChannelReq. Test and itest updates correctly switch to SatPerVbyte. I could not independently confirm from the diff that OpenChannelSync and BatchOpenChannel route through the guarded handlers, but nothing in the visible context contradicts the release-notes enumeration.

Findings: 🔴 0 Blocker · 🟠 0 Major · 🟡 1 Minor · 🔵 0 Nit

Comment thread lnrpc/rpc_utils.go
@lightninglabs-gateway

lightninglabs-gateway Bot commented Jul 9, 2026

Copy link
Copy Markdown

🤖 gateway audit metadata for this PR — auto-generated, please don't edit.

The --sat_per_byte flag was hidden and deprecated in v0.13.0 in favor of
--sat_per_vbyte. Remove it from the sendcoins, sendmany, openchannel,
closechannel, closeallchannels, bumpfee, bumpclosefee and
bumpforceclosefee commands, and simplify the fee-rate flag validation
accordingly.
@MPins
MPins force-pushed the remove_deprecated_sat_per_byte branch from 0207a05 to 395372b Compare July 16, 2026 14:04
@lightninglabs-deploy

Copy link
Copy Markdown
Collaborator

@saubyk: review reminder
@MPins, remember to re-request review from reviewers when ready

@saubyk

saubyk commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

/gateway re-review

@lightninglabs-gateway lightninglabs-gateway Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gateway review — 1 finding

🔴 0 Blocker · 🟠 1 Major · 🟡 0 Minor · 🔵 0 Nit

Summary

This is a clean, well-tested completion of the long-planned sat_per_byte removal: the deprecated field is rejected at the RPC boundary, the fee helpers (CalculateFeeRate, maybeUseDefaultConf) are correctly narrowed, stale //nolint:staticcheck markers are dropped, and new unit tests cover the rejection on every affected handler. The fee-path semantics were verified to have full parity with the prior three-argument behavior, and no fund-loss, panic, or DoS path was found.

The one prior finding is partially resolved. The rejection was upgraded to codes.InvalidArgument in the four rpcserver.go handlers exactly as suggested, but the walletrpc.BumpFee path was missed and still surfaces the removal as codes.Unknown — now inconsistent with its five sibling RPCs in this very PR. No new defects were introduced.

Bot commands
  • /gateway re-review — re-run after pushing changes
  • /gateway dismiss <id> — silence a finding (maintainers)
  • /gateway explain <id> — elaborate on a finding (anyone)

Comment thread lnrpc/walletrpc/walletkit_server.go
MPins added 3 commits July 17, 2026 22:15
The sat_per_byte field was deprecated in v0.13.0 in favor of
sat_per_vbyte. Until now the server silently treated sat_per_byte as
sat/vbyte, which was misleading. Rather than honoring it, the affected
RPCs (SendCoins, SendMany, OpenChannel, OpenChannelSync, CloseChannel
and walletrpc.BumpFee) now return an explicit error when the field is
set, so that an old client talking to a new daemon fails loudly instead
of having its requested fee rate silently dropped.

CalculateFeeRate and maybeUseDefaultConf are simplified to only take the
sat_per_vbyte value now that the deprecated field is no longer honored.
The wallet import test set the deprecated SatPerByte field on
SendCoinsRequest, which the server now rejects. Switch it to
SatPerVbyte, which carries the same sat/vbyte value.
@MPins
MPins force-pushed the remove_deprecated_sat_per_byte branch from 395372b to 1009fa8 Compare July 18, 2026 01:17
@MPins

MPins commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

/gateway re-review

@lightninglabs-gateway

Copy link
Copy Markdown

Sorry, /gateway re-review requires maintainer permission.

@saubyk

saubyk commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

/gateway re-review

@lightninglabs-gateway lightninglabs-gateway Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gateway review — 1 finding

🔴 0 Blocker · 🟠 1 Major · 🟡 0 Minor · 🔵 0 Nit

Summary

The prior concern (F1) is resolved: every client-facing rejection of the removed sat_per_byte field now returns status.Error(codes.InvalidArgument, …) — the four rpcserver.go handlers wrap it directly, and walletkit_server.go's BumpFee catches ErrSatPerByteRemoved via errors.Is and re-wraps it, so gRPC clients get a stable InvalidArgument code instead of codes.Unknown.

One genuinely-new issue surfaced in the newly-added rejection checks. The diff systematically removes // nolint:staticcheck from every place rpcserver.go (package lnd) previously read the deprecated lnrpc.*Request.SatPerByte field, but the four new if in.SatPerByte != 0 guards it adds omit that same directive — while the same-package walletrpc code, which never needed the directive, correctly goes without. This is a cross-package deprecated-field read that the repo's own convention (visible throughout this very diff) requires be annotated, so it will fail make lint.

Otherwise the mechanical removal is clean: CalculateFeeRate/maybeUseDefaultConf signatures are simplified with all call sites updated, the CLI flag/checkNotBothSet plumbing is consistent, and test coverage exercises all four rejecting RPCs plus validateBumpFeeRequest.


Status of prior findings

  • F1 addressed: Resolved. rpcserver.go now returns status.Error(codes.InvalidArgument, lnrpc.ErrSatPerByteRemoved.Error()) in SendCoins (line ~1361), SendMany (~1609), parseOpenChannelReq (~2118), and CloseChannel (~2759); lnrpc/walletrpc/walletkit_server.go BumpFee maps the sentinel to codes.InvalidArgument via errors.Is. Clients can now detect the removed-field rejection by gRPC status code rather than by string-matching, which was the substance of the prior concern.
Bot commands
  • /gateway re-review — re-run after pushing changes
  • /gateway dismiss <id> — silence a finding (maintainers)
  • /gateway explain <id> — elaborate on a finding (anyone)

Comment thread rpcserver.go
func (r *rpcServer) SendCoins(ctx context.Context,
in *lnrpc.SendCoinsRequest) (*lnrpc.SendCoinsResponse, error) {

// The deprecated sat_per_byte field is no longer honored.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI reports no lint errors.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/gateway dismiss per #10889 (comment)

Reads of the deprecated SatPerByte field can't produce a lint error, with or without nolint annotations — which is why the lint CI job passes on this PR. The // nolint:staticcheck comments this diff removes are vestigial from before the check was disabled (and the space-separated // nolint: form isn't a machine-readable directive to golangci-lint anyway). Adding the suggested annotations would just introduce dead comments.

Comment thread rpcserver.go
func (r *rpcServer) SendCoins(ctx context.Context,
in *lnrpc.SendCoinsRequest) (*lnrpc.SendCoinsResponse, error) {

// The deprecated sat_per_byte field is no longer honored.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI reports no lint errors.

@saubyk

saubyk commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

/gateway dismiss F2 per #10889 (comment)

@lightninglabs-gateway

Copy link
Copy Markdown

🚫 Dismissed F2 (major) by @saubyk — per #10889 (comment)

All findings on this PR are addressed or dismissed.

@saubyk

saubyk commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

/gateway re-review

@lightninglabs-gateway

Copy link
Copy Markdown

No new commits since the last gateway review (HEAD is still 1009fa8). Findings still stand.

params, existing, err := w.prepareSweepParams(in, *op, currentHeight)
if err != nil {
// Surface the removal of the deprecated sat_per_byte field as
// InvalidArgument.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since this is the only path where a user-supplied request can produce ErrSatPerByteRemoved (BumpForceCloseFee builds its BumpFeeRequest internally), validateBumpFeeRequest could return the status.Error(codes.InvalidArgument, ...) directly, as rpcserver.go does, avoiding the errors.Is translation here.

Comment thread cmd/commands/commands.go
}

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: grammar — "Check that only one of sat_per_vbyte or conf_target is set, not both." (same comment at L852)

| [`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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also mention the removed lncli flags here (openchannel, sendcoins, sendmany, closechannel, closeallchannels, bumpfee, bumpclosefee, bumpforceclosefee)?

nit: the table rows are missing their trailing |.

}

// `sat_per_byte` was deprecated we only use sats/vbyte now.
if ctx.IsSet("sat_per_byte") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the hidden flags fully removed, lncli ... --sat_per_byte=N now fails with urfave/cli's generic "flag provided but not defined" instead of a targeted message like the one removed here. Probably fine for a removal PR, but an alternative is keeping the hidden flags for one more release with a handler error pointing at sat_per_vbyte, mirroring the RPC's InvalidArgument message. Judgment call — flagging for a conscious decision.

@saubyk

saubyk commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

One item not visible in this diff: the proto field comments for sat_per_byte still say "Deprecated, use sat_per_vbyte", implying the field is still honored. The API docs linked in the release notes are generated from those comments, so they should be updated to note the field is now rejected (and regenerated via make rpc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway-active severity-critical Requires expert review - security/consensus critical

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants