Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing transaction stuck in mempool with low fee #7313

Open
guybrushino opened this issue May 15, 2024 · 8 comments
Open

Closing transaction stuck in mempool with low fee #7313

guybrushino opened this issue May 15, 2024 · 8 comments
Labels
in diagnostic issue under diagnostic

Comments

@guybrushino
Copy link

I know it's a common problem, but I can't solve this.
I have already done CPFP by spending the output of the closing transaction with a higher fee, but in this case, I cannot see my UTXO.

Stuck transaction is:
https://mempool.space/tx/78f2f987c8b829b5dd85f51eff06f2e3327aa8d3caf3ad065ac24da816307269

To_us_msat is
"to_us_msat": 14020345

lightning-cli listpeers 02fa48fa6703a82c521561a2d52ffeb8929fa1cae205129b00e84ddc5f04ed35d4
{
   "peers": [
      {
         "id": "02fa48fa6703a82c521561a2d52ffeb8929fa1cae205129b00e84ddc5f04ed35d4",
         "connected": false,
         "num_channels": 1,
         "features": "",
         "channels": [
            {
               "state": "AWAITING_UNILATERAL",
               "scratch_txid": "78f2f987c8b829b5dd85f51eff06f2e3327aa8d3caf3ad065ac24da816307269",
               "last_tx_fee_msat": 407000,
               "lost_state": false,
               "feerate": {
                  "perkw": 561,
                  "perkb": 2244
               },
               "short_channel_id": "763030x2486x1",
               "direction": 1,
               "channel_id": "fb33a559c409212e71e498ff6931ac0a65ee53747655099798942a6673732b02",
               "funding_txid": "032b7373662a9498970955767453ee650aac3169ff98e4712e2109c459a533fb",
               "funding_outnum": 1,
               "close_to_addr": "bc1qrkdtsp4a2skd2zdwfragf640sc4ju8hu93prjj",
               "close_to": "00141d9ab806bd542cd509ae48fa84eaaf862b2e1efc",
               "private": false,
               "opener": "remote",
               "closer": "local",
               "alias": {
                  "local": "10237438x3564029x22605"
               },
               "features": [
                  "option_static_remotekey"
               ],
               "funding": {
                  "local_funds_msat": 0,
                  "remote_funds_msat": 1200000000,
                  "pushed_msat": 0
               },
               "to_us_msat": 14020345,
               "min_to_us_msat": 0,
               "max_to_us_msat": 814416711,
               "total_msat": 1200000000,
               "fee_base_msat": 0,
               "fee_proportional_millionths": 10,
               "dust_limit_msat": 546000,
               "max_total_htlc_in_msat": 18446744073709551615,
               "their_reserve_msat": 12000000,
               "our_reserve_msat": 12000000,
               "spendable_msat": 2020345,
               "receivable_msat": 1172781655,
               "minimum_htlc_in_msat": 0,
               "minimum_htlc_out_msat": 1,
               "maximum_htlc_out_msat": 1188000000,
               "their_to_self_delay": 144,
               "our_to_self_delay": 144,
               "max_accepted_htlcs": 30,
               "state_changes": [
                  {
                     "timestamp": "2022-11-13T16:15:06.661Z",
                     "old_state": "CHANNELD_AWAITING_LOCKIN",
                     "new_state": "CHANNELD_NORMAL",
                     "cause": "remote",
                     "message": "Lockin complete"
                  },
                  {
                     "timestamp": "2023-12-12T14:32:34.476Z",
                     "old_state": "CHANNELD_NORMAL",
                     "new_state": "CHANNELD_SHUTTING_DOWN",
                     "cause": "user",
                     "message": "User or plugin invoked close command"
                  },
                  {
                     "timestamp": "2023-12-12T14:32:35.547Z",
                     "old_state": "CHANNELD_SHUTTING_DOWN",
                     "new_state": "AWAITING_UNILATERAL",
                     "cause": "user",
                     "message": "Forcibly closed by `close` command timeout"
                  }
               ],
               "status": [
                  "Loaded from database"
               ],
               ...
            }
         ]
      }
   ]
}

I imported all the descriptors into Sparrow Wallet, but I can't see that address bc1qkh28n3jglp0zh9qtxtsfmxdq00xgwldtykvv3lf46mfqpzg9zuhsdj00lg

Am I missing something trivial?

@vincenzopalazzo vincenzopalazzo added the in diagnostic issue under diagnostic label May 17, 2024
@vincenzopalazzo
Copy link
Collaborator

Sorry to be late here, what is the sequence of commands that you follow to do CPFP?

@Lagrang3
Copy link
Collaborator

It's a force close, by the message in the listpeers command. The outputs are Segwit scripts (P2WSH) that's why the address doesn't show in your wallet.

@guybrushino
Copy link
Author

Sorry to be late here, what is the sequence of commands that you follow to do CPFP?

As in this case here, I simply spent my output at a higher fee with lightning-cli withdraw
https://mempool.space/tx/452fd94859200ecc5da3ab5508cd70daf665e5ada603824f720f9fa762cfc354

But in the case of a force close, whose peer has disappeared (i think forever) and whose fees have been too low for more than 4 months, what can be done?

@vincenzopalazzo
Copy link
Collaborator

Ah good point @Lagrang3

I ingore the json output, I assume that this is a pre-anchor channel, and I need to think a bit about how it is possible to replace this TX, when I will be back to my desk at the end of the week, but maybe @Lagrang3 has some idea

@Lagrang3
Copy link
Collaborator

This is precisely why we needed the anchors. If you broadcasted the force close tx, your lightning node cannot spend your output before the relative timelock, with respect to the blockheight when the transaction was confirmed, but since it has not been confirmed, the "time" is frozen. The counterparty (your peer) doesn't have the timelock in his output, he is the one who can CPFP.

@guybrushino
Copy link
Author

guybrushino commented May 20, 2024

Ok, I think I understand that nothing can be done, except hoping that the mempool returns to 2 sat/vbyte 🙂
(or paying a miner to mine my commitment tx)

@Lagrang3
Copy link
Collaborator

Yes, either:

  1. you pay out-of-band, or
  2. transations fees return to 2 sat/vbyte, or
  3. your peer recovers his node and bumps the tx to confirm this 0.01 BTC he has available there, or

what if your peer completely lost his node's database and hdwallet?
and your node has not deleted old commitment transactions.
Maybe, there's an older commitment tx with a higher feerate.
You could risk broadcasting that tx, which will effectively RBF the current tx.

In the worst case your peer will wake up and punish you taking all the funds which where anyways mostly on his side.
And if he doesn't it probably means that he lost his data and he wasn't unable anyways to recover the funds.

@guybrushino
Copy link
Author

Interesting!
Is it possible that I find an old commitment transactions in the CoreLn database?
Or every time it is renegotiated, the previous transaction is deleted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in diagnostic issue under diagnostic
Projects
None yet
Development

No branches or pull requests

3 participants