Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

CLN v25.12 force-close sweep credited “to_wallet” but resulting UTXO missing from wallet / outputs table

オープン
#9,092 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
c
領域
backend, database

調査の方向性

まず listfunds の背後にある wallet state と outputs table を確認し、次に sweep transaction 738e4f22... と bkpr account events を使って報告された不一致を再現します。dev-rescan-outputs、upgradewallet、emergencyrecover の結果を、既存の chain_moves record と比較します。確認済みの UTXO が wallet state に復元され、listfunds に表示され、使用可能で、account が解決されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

QA

Environment
Core Lightning version: v25.12
Network: bitcoin mainnet
Backend: bitcoind
Node running on Raspberry Pi
lightning-dir reported by getinfo:
/home/lightning/.lightning/bitcoin/bitcoin
Summary

I accidentally force-closed a channel. CLN successfully broadcast the close tx and later swept my delayed-to-us output into a wallet output. However, the resulting on-chain UTXO is confirmed and unspent, but missing from CLN wallet state:

not shown in listfunds
not present in outputs table
not spendable via withdraw
channel bookkeeping shows funds moved to_wallet
closed channel account remains account_resolved: false

This appears to be a wallet bookkeeping inconsistency after force-close recovery.

Channel details

Closed channel:

peer_id:
02dbdf2312bb589a721604f3cff62d11f0d9adcd3602a66df3c413e8ba0c565692
channel_id:
fb29a3ae295a0593c4d54ed007ee56af14d17d3f8d8b86647e8f80eb861df56c
short_channel_id:
931910x989x0

Funding tx:

6cf51d86eb808f7e64868b8d3f7dd114af56ee07d04ed5c493055a29aea329fb:0

listclosedchannels showed:

close_cause: local
final_to_us_msat: 400000000
Close transaction

Commitment / close tx:

f7b1a5a8b4cddea0d04b9459425aac4e02ee91a9e8ccf67d21e1434e1e0d38e2

Outputs:

vout 0: anchor-ish dust output 0.00000330 BTC
vout 1: delayed-to-us output 0.00397930 BTC
Sweep transaction created by CLN

Later CLN swept f7b1...:1 via:

738e4f2258599de14778a242559c808950794682d30a5ca82dc885e8d351a239

Input:

f7b1a5a8...38e2:1

Output:

vout 0
0.00397796 BTC (397,796 sats)
Taproot address:
bc1pqa7nuntpczpqsd624dsef6pmt944nhyq3pth9uqy2ecx0cksfw4spv94z0
Blockchain state

bitcoin-cli gettxout 738e4f22... 0 returns:

output is still unspent
confirmations ~6500+
value 0.00397796

So funds exist on-chain and remain unspent.

CLN wallet behavior
listfunds

Does not show 738e4f22...:0.

It only showed my unrelated wallet UTXOs, e.g. later:

8e1f0897...:1
89,547 sats
withdraw

Attempt to withdraw > visible balance:

ltng withdraw 150000sat
Could not afford 150000sat using all 0 available UTXOs

So CLN does not consider 738e4f22...:0 spendable.

Bookkeeper / accounting evidence

bkpr-listaccountevents shows:

delayed_to_us credit
account: closed channel id
tag: delayed_to_us
credit_msat: 397930000
outpoint:
f7b1...:1
to_wallet debit
same account
tag: to_wallet
debit_msat: 397930000
txid:
738e4f2258599de14778a242559c808950794682d30a5ca82dc885e8d351a239

So CLN explicitly believes the delayed output was swept to wallet.

bkpr-listbalances

Closed channel account shows:

{
"account_closed": true,
"account_resolved": false,
"balance_msat": 0
}

Wallet account only shows later visible wallet UTXO balance, not the missing 397k sats.

SQLite findings
outputs table schema
CREATE TABLE outputs (
prev_out_tx BLOB,
prev_out_index INTEGER,
value INTEGER,
type INTEGER,
status INTEGER,
keyindex INTEGER,
...
PRIMARY KEY(prev_out_tx, prev_out_index)
);
Missing UTXO absent

Querying for:

738e4f22...:0

returned no rows.

Existing outputs present

Normal wallet outputs exist, e.g. later change output:

8e1f0897...:1
keyindex 56

So wallet table works generally; only recovered sweep output is missing.

chain_moves confirms sweep accounting
select ... from chain_moves where spending_txid = 738e4f...

shows record tied to the delayed output amount (~397,930 sats).

Recovery attempts already tried
RPC / wallet repair
dev-rescan-outputs
did not restore missing UTXO
upgradewallet
upgraded_outs: 0
emergencyrecover
no useful stubs / no recovery of this output
Descriptor / hsm attempts
lightning-hsmtool dumponchaindescriptors
imported tr(...) descriptor into Bitcoin Core wallet
could derive normal wallet addresses, but not this missing output address
suggests recovered sweep output may use different derivation path / special path
Expected behavior

After sweeping delayed-to-us output into wallet, CLN should:

Insert resulting UTXO into wallet state
Show it in listfunds
Allow spending via withdraw
Mark closed channel account resolved once complete
Actual behavior

CLN accounting says funds moved to wallet, but wallet never gained the UTXO.

Questions
Is this a known bug in v25.12 involving force-close sweep to Taproot outputs?
Is there a supported way to reconstruct / reinsert missing wallet UTXO state?
Is this output derived from a nonstandard path not included in dumponchaindescriptors?
Recommended safe recovery path for spending 738e4f22...:0?
Impact

~397,796 sats are stranded in an unspent on-chain output controlled by CLN-generated keys but not recognized by wallet state.

主要言語
C
スター
3.1k
フォーク
1k
平均マージ
4日 2時間
マージ済み PR(30日)
30

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ElementsProject/lightning のほかの issue

ElementsProject/lightning の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。