Skip to content

[bug]: reserved wallet balance takes unconfirmed balance into account #9926

@luisschwab

Description

@luisschwab

Background

For a channel to be opened, the node's wallet needs to have enough funds for fee bumping anchor channel closings. Currently, enough funds includes unconfirmed balance (which can easily be RBF'ed to another address, leaving no funds for bumps), allowing the channel open to happen even without enough confirmed funds.

Your environment

$ lnd --version
lnd version 0.18.5-beta commit=v0.18.5-beta

Steps to reproduce

  1. Let x be the total_balance, and let y be the reserved_balance_anchor_chan.
  2. Try to open a channel of size z, where z = x - y. It should fail because of lack of reserve funds for the new channel.
  3. Deposit enough bitcoin such that it would leave enough funds for the channel's fee bumping anchor channel closing reserve. Try to open the channel again while the additional balance is unconfirmed. It opens.

Expected behaviour

While the additional balance is unconfirmed, channel opening should fail.

Actual behaviour

Channel opening succeeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended code behaviour

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions