lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.65k stars 2.07k forks source link

[bug]: Not able to bumpclosefee of an anchor channel in a special case (no HLTCs at stake). #8837

Closed ziggie1984 closed 2 months ago

ziggie1984 commented 3 months ago

LND 18 has a new reworked sweeper subsystem. Before we would register the Anchors with the sweeper subsystem every time a channel was force closed. Right now we check if HTLCs are on the channel when it goes onchain. If it is not the case we do not register the anchors with our sweeper subsystem.

Now if the user wants to bump the commitment tx (lncli wallet bumpforceclosefee) it is not possible because no anchor sweep is registered. It just quietly fails on the lncli level.

Thought a bit about the design because I think this is a mandatory feature, commitment fees might be very low so using the anchor to accelerate the confirmation.

I came up with the following idea, happy to hear your thoughts before implementing:

ziggie1984 commented 3 months ago

cc @yyforyongyu

yyforyongyu commented 3 months ago

I think the fix is fairly simple - we just offer the anchor to the sweeper with a very large deadline here, basically remove this check, https://github.com/lightningnetwork/lnd/blob/cf88a8ae04536bf320038c691c58992289562a3b/contractcourt/channel_arbitrator.go#L1325-L1333

saubyk commented 3 months ago

Hi @ziggie1984 we are also missing documentation for the bumpforceclosefee rpc: https://lightning.engineering/api-docs/category/walletkit-service

ziggie1984 commented 3 months ago

Hi @ziggie1984 we are also missing documentation for the bumpforceclosefee rpc: https://lightning.engineering/api-docs/category/walletkit-service

exactly most of the logic is in the lncli program, I think it makes sense to introduce its own rpc call for it so that we can trigger the bumping of force closes also via RPC

MegalithicBTC commented 2 months ago

Looks like we were hit with this issue, would be happy to provide any diagnostics or logs that could be useful..

Here is the transaction: https://mempool.space/tx/030211043d05dd3a5c711eba67ae50647a95202be22d6782d4e5d98ba14a1006

{
            "channel":  {
                "remote_node_pub":  "0393a6f8fd63adc4d604fb4700904fbaf0903c5ea6b91e8a9751bd6ab6661c987b",
                "channel_point":  "7ef3df91e91fb5734bee5654289836f73737fa4dfd87e3dd032e8fb95d354d59:1",
                "capacity":  "2500000",
                "local_balance":  "2473523",
                "remote_balance":  "25104",
                "local_chan_reserve_sat":  "25000",
                "remote_chan_reserve_sat":  "25000",
                "initiator":  "INITIATOR_REMOTE",
                "commitment_type":  "ANCHORS",
                "num_forwarding_packages":  "0",
                "chan_status_flags":  "ChanStatusBorked|ChanStatusCommitBroadcasted|ChanStatusLocalCloseInitiator",
                "private":  false,
                "memo":  ""
            },
            "limbo_balance":  "2473523",
            "commitments":  {
                "local_txid":  "030211043d05dd3a5c711eba67ae50647a95202be22d6782d4e5d98ba14a1006",
                "remote_txid":  "4031f026839fa8ea4bc3ab9a731b49f2ad4cf21c587088b503d6470532f6a155",
                "remote_pending_txid":  "",
                "local_commit_fee_sat":  "712",
                "remote_commit_fee_sat":  "712",
                "remote_pending_commit_fee_sat":  "0"
            },
            "closing_txid":  "030211043d05dd3a5c711eba67ae50647a95202be22d6782d4e5d98ba14a1006",
            "closing_tx_hex":  ""
        }

this transaction does NOT appear in pendingsweeps

{
        "pending_sweeps": [
                {
                        "outpoint": "0ce7adb3c6ce22fa667cb510cf6ef87a8ec67f12106a59b666eac49c9dd6004f:1",
                        "witness_type": "COMMITMENT_ANCHOR",
                        "amount_sat": 330,
                        "sat_per_vbyte": 0,
                        "broadcast_attempts": 125,
                        "next_broadcast_height": 0,
                        "requested_sat_per_vbyte": 0,
                        "requested_conf_target": 0,
                        "force": false
                },
                {
                        "outpoint": "0f24ad3ac9cbd34bc2138bd8351812d5eb237a94b67c0851501a779870c7f53f:0",
                        "witness_type": "COMMITMENT_ANCHOR",
                        "amount_sat": 330,
                        "sat_per_vbyte": 0,
                        "broadcast_attempts": 0,
                        "next_broadcast_height": 0,
                        "requested_sat_per_vbyte": 0,
                        "requested_conf_target": 0,
                        "force": false
                },
                {
                        "outpoint": "cc03e9fba55ae98ecc7a1edb88f1551ead64a6a07da04e778d026b9a18a08307:1",
                        "witness_type": "COMMITMENT_ANCHOR",
                        "amount_sat": 330,
                        "sat_per_vbyte": 0,
                        "broadcast_attempts": 108,
                        "next_broadcast_height": 0,
                        "requested_sat_per_vbyte": 0,
                        "requested_conf_target": 0,
                        "force": false
                }
        ]
}

attempts with bumpfee are so far unsuccessful

lncli wallet bumpforceclosefee --sat_per_vbyte 46 7ef3df91e91fb5734bee5654289836f73737fa4dfd87e3dd032e8fb95d354d59:1 --immediate
(no output from CLI)
lncli wallet bumpfee  030211043d05dd3a5c711eba67ae50647a95202be22d6782d4e5d98ba14a1006:1 --budget 15000
[lncli] rpc error: code = Unknown desc = the passed output does not belong to the wallet
lncli wallet bumpfee  030211043d05dd3a5c711eba67ae50647a95202be22d6782d4e5d98ba14a1006:0 --budget 15000
[lncli] rpc error: code = Unknown desc = the passed output does not belong to the wallet