Skip to content

With an anchor-channel open having only a single UTXO cannot be selected for SendCoins/SendMany #5648

Closed
@bjarnemagnussen

Description

@bjarnemagnussen

Background

When using anchor-channels a minimum reserved wallet balance is required (10_000 sats/channel; maximum 100_000 sats).

When the node has some anchor-channel open and only a single UTXO in the wallet, then calling SendCoins or SendMany to send some on-chain funds out is impossible as it returns the error reserved wallet balance invalidated, even though we send out an amount that would leave sufficient funds on the node.

However, it is still possible to call OpenChannel to open a channel as long as we fund it with an amount that leaves enough on-chain funds for the reserved wallet balance.

As a work-around it is possible to request a new address on the node and then use SendCoins or SendMany to actively send an amount equal to (or greater than) the required reserved wallet balance to your own address. This splits the UTXO and makes it possible to now send funds out again.

It therefore seems that the problem is that the check for reserved wallet balance is done without knowledge of a change output using SendCoins/SendMany, while this is known when opening a new channel with OpenChannel?

Your environment

  • version of lnd: 0.13.0/0.13.1
  • which operating system (uname -a on *Nix): linux

Steps to reproduce

  1. Create a new node.
  2. Generate a new address and send funds to this address.
  3. From the node open an anchor-channel to some remote. Now all of the on-chain funds are in a single UTXO, which are un-spendable using SendCoins/SendMany when trying to send to an external address (even though the transaction would leave sufficient funds for the wallet reserve on the node).
  4. It is still possible to open channels and to split the UTXO when actively sending funds to your own address requested via newaddress.

Expected behaviour

It should be possible to detect that the change output of a transaction from SendCoins/SendMany would leave sufficient wallet reserve funds.

Actual behaviour

The error reserved wallet balance invalidated is returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    anchorsbugUnintended code behaviourvalidationwalletThe wallet (lnwallet) which LND uses

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions