ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.86k stars 906 forks source link

Channels stuck in DUALOPEN_AWAITING_LOCKIN after trying to take "Liquidity Ad" from Ride the Lightning #7720

Open Javihache opened 1 month ago

Javihache commented 1 month ago

I've been trying to fix this issue for several days now. I've even tried to rescan the full blockchain with Core Lightning (which took almost 2 days) to no avail.

I tried to take a couple of Liquidity Ads from RTL. However I got the message on screen, that although I had set 10sats/vB, the fee was too low. I am guessing this is some kind of bug between RTL and Core Lightning.

The fee with which the transactions were being built was 1sat/vB. I thought those transactions were just failing, but in reality I "opened" 4 channels with one node and another channel with a second node.

After rescanning the Blockchain I don't see the TXs in the mempool of my Bitcoin Node or on mempool.space.

I tried closing the channels for which I get another txid which is also nowhere to be found on my mempool or on mempool.space.

I don't know how to delete these channels... I thought of using dev-forget-channel but the multiple warnings scare me a bit and also the fact that I think I need some special build to actually execute that command.

Do you guys think it's safe for me to dev-forget-channel these channels?

They all look similar to this:

 {
         "peer_id": "0225e29bcf897f22d9f546ad71185f9519db538d484b2fd2ea2be02e20b5c7224b",
         "connected": true,
         "state": "DUALOPEND_AWAITING_LOCKIN",
         "channel_id": "543f5e2ad6a5575d9aa9f5731b919f2845f2a50dad26727205adb84650bcf92d",
         "our_amount_msat": 1000000000,
         "amount_msat": 2003253000,
         "funding_txid": "39910f71c00f81be72ee3ccaaf3569cbd6bedf471892bcb3ffd9000c79c4d626",
         "funding_output": 0
      },

When trying to close I get:

# Sending closing fee offer 337sat, with range 195sat-406sat
# Received closing fee offer 350sat, with range 195sat-2003253sat
# Sending closing fee offer 350sat, with range 195sat-406sat
{
   "tx": "0200000000010126d6c4790c00d9ffb3bc921847dfbed6cb6935afca3cee72be810fc0710f91390000000000ffffffff02e2400f000000000022512006e0251cc8546b10730a88526c207afaf9acd1c4d0ddd8c73d3430a458e22902f54e0f0000000000225120e9afd4a031eae31a99c0b47ffd96829b90ce05ee0a3aa4410996ca55fd0e6b96040047304402202efcfa09bb36299260c9a10f1e6c0ac8cbdb4488d26d6d707985ac1e5e28779c022073f45c6d47648f33e6b10844985dc089dc2001e766bc3af92b48338b4713333a0147304402205ed8942df4b9ddd6ff33c1867306c9d11151e5240e000ef8b58c067ec626360302207e9280c9b1544e429a13684cdf16e0c0657c588da7e91d20e1d7080bb2e0203f0147522103965e2e437b9baa68ecbd0cdbadf7c009e3ea826ab1c36ddcee7b354d347325332103f1e3e53924f9fe8d69ce97e65c4997e126dff2926a2bf8da0598a89bc05b431c52ae00000000",
   "txid": "8fd31f6d2c892ecf76bedb0e26b2690abc9f38b03033e50d755e3aecf0964208",
   "type": "mutual"
}

But then when I try to check the txid:

bitcoin-core.cli getmempoolentry 8fd31f6d2c892ecf76bedb0e26b2690abc9f38b03033e50d755e3aecf0964208
error code: -5
error message:
Transaction not in mempool

Hope someone can give me a hint on how to solve this issue.

Thanks in advance!

pabpas commented 1 month ago

I am running the other node so I can support from my side, at least with some info. This is what I see:

$ lightning-cli listpeerchannels 03f724b4bc6cb04f45068c0fc542c35e7d82dbe750383e2eda229c8304699f48f2
{
   "channels": [
      {
         "peer_id": "03f724b4bc6cb04f45068c0fc542c35e7d82dbe750383e2eda229c8304699f48f2",
         "peer_connected": false,
         "channel_type": {  
            "bits": [
               12,
               22
            ],
            "names": [
               "static_remotekey/even",
               "anchors/even"
            ]
         },
         "updates": {
            "local": {
               "htlc_minimum_msat": 100000,
               "htlc_maximum_msat": 1983221000,
               "cltv_expiry_delta": 34,
               "fee_base_msat": 100,
               "fee_proportional_millionths": 500
            }
         },
         "state": "CLOSINGD_COMPLETE",
         "scratch_txid": "8fd31f6d2c892ecf76bedb0e26b2690abc9f38b03033e50d755e3aecf0964208",
         "last_tx_fee_msat": 350000,
         "lost_state": false,
         "feerate": {
            "perkw": 1250,  
            "perkb": 5000   
         },
         "direction": 0,
         "channel_id": "543f5e2ad6a5575d9aa9f5731b919f2845f2a50dad26727205adb84650bcf92d",
         "funding_txid": "39910f71c00f81be72ee3ccaaf3569cbd6bedf471892bcb3ffd9000c79c4d626",
         "funding_outnum": 0,
         "initial_feerate": "253perkw",
         "last_feerate": "253perkw",
         "next_feerate": "263perkw",
         "inflight": [
            {
               "funding_txid": "39910f71c00f81be72ee3ccaaf3569cbd6bedf471892bcb3ffd9000c79c4d626",
               "funding_outnum": 0,
               "feerate": "253perkw",
               "total_funding_msat": 2003253000,
               "our_funding_msat": 1003253000,
               "splice_amount": 0,
               "scratch_txid": "695553bd13dd530b734246d61a013e7f075f15037277c165684d19df8a5ddf8d"
            }
         ],
         "close_to_addr": "bc1paxhafgp3at334xwqk3llm95znwgvup0wpga2gsgfjm99tlgwdwtquywe3f",
         "close_to": "5120e9afd4a031eae31a99c0b47ffd96829b90ce05ee0a3aa4410996ca55fd0e6b96",
         "private": false,  
         "opener": "remote",
         "closer": "remote",
         "alias": {
            "local": "7577112x16253260x14161"
         },
         "features": [
            "option_static_remotekey",
            "option_anchors"
         ],
         "funding": {
            "remote_funds_msat": 1003253000,
            "local_funds_msat": 1000000000,
            "fee_rcvd_msat": 3253000
         },
         "to_us_msat": 1003253000,
         "min_to_us_msat": 1003253000,
         "max_to_us_msat": 1003253000,
         "total_msat": 2003253000,
         "fee_base_msat": 100,
         "fee_proportional_millionths": 500,
         "dust_limit_msat": 546000,
         "max_total_htlc_in_msat": 18446744073709551615,
         "their_reserve_msat": 20032000,
         "our_reserve_msat": 20032000,
         "spendable_msat": 983221000,
         "receivable_msat": 975677000,
         "minimum_htlc_in_msat": 0,
         "minimum_htlc_out_msat": 100000,
         "maximum_htlc_out_msat": 1983221000,
         "their_to_self_delay": 144,
         "our_to_self_delay": 144,
         "max_accepted_htlcs": 30,
         "state_changes": [ 
            {
               "timestamp": "2024-10-02T17:05:56.775Z",
               "old_state": "DUALOPEND_OPEN_COMMITTED",
               "new_state": "DUALOPEND_AWAITING_LOCKIN",
               "cause": "remote",
               "message": "Sigs exchanged, waiting for lock-in"
            },
            {
               "timestamp": "2024-10-05T12:00:36.167Z",
               "old_state": "DUALOPEND_AWAITING_LOCKIN",
               "new_state": "CHANNELD_SHUTTING_DOWN",
               "cause": "remote",
               "message": "Peer closes channel"
            },
            {
               "timestamp": "2024-10-05T12:00:36.927Z",
               "old_state": "CHANNELD_SHUTTING_DOWN",
               "new_state": "CLOSINGD_SIGEXCHANGE",
               "cause": "remote",
               "message": "Start closingd"
            },
{
               "timestamp": "2024-10-05T12:00:38.137Z",
               "old_state": "CLOSINGD_SIGEXCHANGE",
               "new_state": "CLOSINGD_COMPLETE",
               "cause": "remote",
               "message": "Closing complete"
            }
         ],
         "status": [
            "Loaded from database"
         ],
         "in_payments_offered": 0,
         "in_offered_msat": 0,
         "in_payments_fulfilled": 0,
         "in_fulfilled_msat": 0,
         "out_payments_offered": 0,
         "out_offered_msat": 0,
         "out_payments_fulfilled": 0,
         "out_fulfilled_msat": 0,
         "htlcs": []
      }
   ]
}

I also see in the logs that sendrawtransaction of the scratch_txid fails with:

error code: -25\\nerror message:\\nbad-txns-inputs-missingorspent"

I think my node does not know about the RBF that happened here?

Javihache commented 1 month ago

Thanks,

I managed to close the channels, but they still show up in my list of channels.

I am now just stuck with four on-chain unconfirmed transactions for 1M sats each, that are also in no mempool (local or remote) and I am trying to figure out how to remove that from core-lightning. ChatGPT suggests fiddling with the lightining.sqlite DB, but that doesn't sound like something I'd like to do.

If lightningd forgets those transactions at some point, I'll just leave them there until that happens.