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

Unilateral channel close, unrecovered funds #7469

Closed
coinlighter opened this issue Jul 13, 2024 · 2 comments
Closed

Unilateral channel close, unrecovered funds #7469

coinlighter opened this issue Jul 13, 2024 · 2 comments

Comments

@coinlighter
Copy link

Issue and Steps to Reproduce

I closed a channel using lightning-cli close but the terminal froze,
I tried a second time and the channel did a unilateral close.

Looking at listclosedchannels, the close_cause shows "protocol" and the last_commitment_id:
282e3f8b7a923d48817e49167b753b04b11ea3f8b5f1c11dc214933e33334e7f

From the mempool explorer, I then follow the next transaction, which shows the force-closed txID:
95c2136c14dac55e1898086f0744b0f3fbf4d54eaf0ae8d24dec820f35ce8272

I can track both of those transactions in listtransactions but none shows in my listfunds.
How can I recover the funds?


getinfo output

lightning-cli getinfo
{
   "id": "02a1991e597d77a2cc9fcc3839de1088dc2d6f8c20c672451cd863b6096a43aa40",
   "alias": "proxlight",
   "color": "ffeedd",
   "num_peers": 3,
   "num_pending_channels": 0,
   "num_active_channels": 3,
   "num_inactive_channels": 0,
   "address": [
      {
         "type": "ipv6",
         "address": "2600:1700:2f70:ff30::43",
         "port": 9735
      }
   ],
   "binding": [
      {
         "type": "ipv6",
         "address": "::",
         "port": 9735
      },
      {
         "type": "ipv4",
         "address": "0.0.0.0",
         "port": 9735
      }
   ],
   "version": "v24.05-modded",
   "blockheight": 852024,
   "network": "bitcoin",
   "fees_collected_msat": 0,
   "lightning-dir": "/home/squid/.lightning/bitcoin",
   "our_features": {
      "init": "080000000000000000000000000008a0882a8a59a1",
      "node": "080000000000000000000000000088a0882a8a59a1",
      "channel": "",
      "invoice": "02000002024100"
   }
}

listclosedchannels output

lightning-cli listclosedchannels | jq '.closedchannels[] | select (.short_channel_id == "848048x1756x0")'
{
  "peer_id": "035b1ff29e8db1ba8f2a4f4f95db239b54069cb949b8cde329418e2a83da4f1b30",
  "channel_id": "18013c0d62c090914482ed1d31429b60674eb3bc4e62696de396a1e49016c465",
  "short_channel_id": "848048x1756x0",
  "alias": {
    "local": "15875206x2335875x57424"
  },
  "opener": "local",
  "closer": "local",
  "private": false,
  "channel_type": {
    "bits": [
      12,
      22
    ],
    "names": [
      "static_remotekey/even",
      "anchors_zero_fee_htlc_tx/even"
    ]
  },
  "total_local_commitments": 0,
  "total_remote_commitments": 1,
  "total_htlcs_sent": 0,
  "funding_txid": "65c41690e4a196e36d69624ebcb34e67609b42311ded82449190c0620d3c0118",
  "funding_outnum": 0,
  "leased": false,
  "total_msat": 4516766000,
  "final_to_us_msat": 4516766000,
  "min_to_us_msat": 4516766000,
  "max_to_us_msat": 4516766000,
  "last_commitment_txid": "282e3f8b7a923d48817e49167b753b04b11ea3f8b5f1c11dc214933e33334e7f",
  "last_commitment_fee_msat": 6837000,
  "close_cause": "protocol",
  "last_stable_connection": 1718467250
}

listtransactions for both close attempts

lightning-cli listtransactions | jq '.transactions[] | select (.hash == "282e3f8b7a923d48817e49167b753b04b11ea3f8b5f1c11dc214933e33334e7f" or .hash == "95c2136c14dac55e1898086f0744b0f3fbf4d54eaf0ae8d24dec820f35ce8272")'
{
  "hash": "282e3f8b7a923d48817e49167b753b04b11ea3f8b5f1c11dc214933e33334e7f",
  "rawtx": "0200000000010118013c0d62c090914482ed1d31429b60674eb3bc4e62696de396a1e49016c46500000000006fd8b480024a010000000000002200202a811f85aa9cc3924fc867427be2f65132991b49fe57fd3ab2c728e9daa45d1c9fcf44000000000022002061bfab2e2a67b18431412d2591268f2a5b43bfe0d0b76b5af463866ff7945e57040047304402206b9c1455484284c02404fe63de5714910494c42fc00af913af12061f1c1b19e5022027ad7a0f18b14cbeeed8ffafebece1f4c9bddee142aa6e6f12c9b49f42a38f6601473044022064685dfc2337c3135cd2c737915e5de490650cfd60b7d6db171fae93fefedbbc022000fb06acde151750ff76678281897a0761388dd6f110e65acf032f51c31e1da80147522102ad127409b46c6f75cb33f9f98c0044589d495ab31d970d487f544019a65b23ff2103d50fed4aa3825fb2054ce4494d4b035fe5de24ebee1e0f5d70013d14c9a9054152aeddbf1320",
  "blockheight": 848070,
  "txindex": 2017,
  "locktime": 538165213,
  "version": 2,
  "inputs": [
    {
      "txid": "65c41690e4a196e36d69624ebcb34e67609b42311ded82449190c0620d3c0118",
      "index": 0,
      "sequence": 2159335535
    }
  ],
  "outputs": [
    {
      "index": 0,
      "amount_msat": 330000,
      "scriptPubKey": "00202a811f85aa9cc3924fc867427be2f65132991b49fe57fd3ab2c728e9daa45d1c"
    },
    {
      "index": 1,
      "amount_msat": 4509599000,
      "scriptPubKey": "002061bfab2e2a67b18431412d2591268f2a5b43bfe0d0b76b5af463866ff7945e57"
    }
  ]
}
{
  "hash": "95c2136c14dac55e1898086f0744b0f3fbf4d54eaf0ae8d24dec820f35ce8272",
  "rawtx": "020000000001017f4e33333e9314c21dc1f1b5f8a31eb1043b757b16497e81483d927a8b3f2e280100000000900000000129c944000000000016001464a45f1caa46f9fd04192959d0319b9d97812d8503473044022054211c04d5c11365b77f35d9b30ef74c324c734effa4238d50522d4220225a8c02206abc0513341b88c5ad47941548398a3482f3a6b1c5658c87adbd10064e16aa9d01004d63210358845f6cc76899d715881933f1bc4c2249c9aed4c5b72800ee30da1a3a491c5c67029000b2752103b8c51f0cf4ec9f232ca6bfde1724aff084142a882642c530d6da538f253e84ea68ac00000000",
  "blockheight": 848274,
  "txindex": 142,
  "locktime": 0,
  "version": 2,
  "inputs": [
    {
      "txid": "282e3f8b7a923d48817e49167b753b04b11ea3f8b5f1c11dc214933e33334e7f",
      "index": 1,
      "sequence": 144
    }
  ],
  "outputs": [
    {
      "index": 0,
      "amount_msat": 4507945000,
      "scriptPubKey": "001464a45f1caa46f9fd04192959d0319b9d97812d85"
    }
  ]
}
@pabpas
Copy link

pabpas commented Jul 21, 2024

transactions are confirmed and should show up in your cln wallet. If they are really missing, I would first try with lightning-cli dev-rescan-outputs. If they are still missing you could try to launch lightningd with --rescan=-848273 (one block before the transaction that sent the funds to your wallet was mined).

@coinlighter
Copy link
Author

It worked!!
I first tried lightning-cli dev-rescan-outputs but it did not reveal the tansaction.
Then I restarted lightningd with --rescan=-848273 and BOUM the transaction appeared in the listfunds.

Thank you very much, should we close this issue or should this be tracked as a bug?

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

No branches or pull requests

2 participants