Skip to content

'withdraw all' fails when 'utxos' specified; leaves UTxOs unavailable #3591

@whitslack

Description

@whitslack

Issue and Steps to Reproduce

$ newaddr=$(lightning-cli newaddr | jq -r .bech32)

$ lightning-cli withdraw "${newaddr}" all 3333perkb 0 '["(my txid):(vout)"]'
{
   "code": 301,
   "message": "Cannot afford transaction with 138sat sats of fees"
}

Attempting the same withdrawal a second time yields:

{
   "code": -32602,
   "message": "No matching utxo was found from the wallet. You can get a list of the wallet utxos with the `listfunds` RPC call."
}

Indeed, the specified <txid>:<vout> is no longer returned in lightning-cli listfunds. The UTxO does appear again after a dev-rescan-outputs, but obviously this is risky and shouldn't be needed.

So there are really two problems here:

  1. C-Lightning should not be marking UTxOs as spent if it didn't actually spend them.
  2. C-Lightning apparently doesn't understand how to spend all of a specified set of UTxOs while deducting enough from their total value to satisfy the specified fee rate.

getinfo output

$ lightning-cli getinfo | jq '{binding, version, blockheight, network, "lightning-dir"}'
{
  "binding": [
    {
      "type": "ipv6",
      "address": "::",
      "port": 9735
    },
    {
      "type": "ipv4",
      "address": "0.0.0.0",
      "port": 9735
    }
  ],
  "version": "0.8.1",
  "blockheight": 621608,
  "network": "bitcoin",
  "lightning-dir": "/var/lib/lightning/bitcoin"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions