Skip to content

LND: unconfirmed balance counts every RBF replacement of a force-close sweep #4778

Open

Description

@myxmaster

Describe the bug

Found while testing #4775 on regtest (lnd 0.20.0, LND REST).

When a force-close sweep doesn't confirm in the next block, lnd replaces it via RBF on every new block. The mempool only holds the newest version, but the wallet keeps every replaced version as unconfirmed and unspent (listchaintxns, listunspent). lnd's unconfirmed_balance therefore grows by one sweep amount per block, and ZEUS shows it as external unconfirmed funds on the pending line.

Measured (limbo 96,860, confirmed 991,415)

Empty blocks Sweep versions in wallet lnd unconfirmed_balance ZEUS total + pending Actual
0 96,395 96,395 1,088,275 1,087,810
1 + 96,348 192,743 1,184,158 1,087,763
2 + 96,300 289,043 1,280,458 1,087,715
3 + 96,252 385,295 1,376,710 1,087,667

It clears once one version confirms: the replaced versions disappear from the wallet, and the balance is exact again.

On mainnet a sweep that waits several blocks is common when mempool is busy, so the pending line can show a multiple of the channel balance for that period.

Possible direction: unconfirmed wallet transactions that spend the same outpoint conflict by consensus, so only one of them can confirm. Count only one of them, and in the total as well, since total_balance includes all versions. Presumably this affects any replaced transaction paying the wallet, not just sweeps (untested). I haven't checked yet whether lnd tracks this upstream.

Reproduce

  1. Force close an anchor channel locally. Mine until lnd broadcasts the sweep (one block before maturity).
  2. Mine empty blocks so the sweep can't confirm, in Polar via btc backend terminal:
    bitcoin-cli -regtest generateblock "$(bitcoin-cli -regtest getnewaddress)" '[]'
    

ZEUS version

v13.2.2

Node interface

LND (REST)

Network

Clearnet

Device

Samsung Galaxy S20+

Device operating system

Android 13

Log output

Activity

  1. kaloudis commented on Sep 28, 2026

    @kaloudis
    Contributor
  2. added
    LNDIssues specific to LND nodes
    UpstreamRequires a change in an upstream dependency (LND, CLN, a library, etc.)
    on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingLNDIssues specific to LND nodesUpstreamRequires a change in an upstream dependency (LND, CLN, a library, etc.)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions