You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
backups: lnd and clightning databases are copied live; a restored channel.db can lose funds #95
Commit: 1528ecf (master, 2026-10-16). File: modules/backups.nix, with docs/services.md and test/tests.py.
What I found
The duplicity file list includes the whole lnd and clightning data directories (modules/backups.nix, the includeFileList). The backup runs while the daemons run. So it copies lnd/.../channel.db and clightning/.../lightningd.sqlite3 live. The unit only waits for the PostgreSQL dumps. Nothing stops or pauses lnd or clightning, and nothing takes a consistent snapshot.
A torn copy. A database file copied during writes may not open after a restore. For lnd this is the bbolt channel.db. For clightning it's the SQLite file and its WAL.
Stale channel state. If a user restores an older channel.db and starts lnd, lnd publishes old channel state. The peer then takes the channel funds through the penalty path. lnd's own guidance is to recover from the seed plus channel.backup, and never from a copied channel.db. The backups module makes that path look normal: the whole directory is in the backup and the docs don't warn.
The test in test/tests.py stops bitcoind before it starts duplicity and checks only that hsm_secret, lnd-seed-mnemonic and wallet.dat are present. It doesn't cover the live-copy case for lnd or clightning.
Proposal
lnd: exclude channel.db from the backup (- ${lnd.dataDir}/chain/*/channel.db style line before the include) or document that the lnd part of the backup is for lnd-seed-mnemonic, channel.backup and tls.* only. channel.backup is safe to copy live. lnd rewrites it atomically.
clightning: point users to services.clightning.replication, which this repo already has, for the database. Keep hsm_secret in the duplicity backup.
docs: add a short warning to the backups section of docs/services.md: never restore a copied channel.db or lightningd.sqlite3 to a node that was online after the copy. Use the seed and channel.backup for lnd and the replication module for clightning.
test: check that the backup doesn't contain channel.db.
I can send a PR for the exclude lines and the docs if you want it.
Astra's grading of a later run on the same commit pointed at one more live copy. modules/backups.nix line 63 includes the whole bitcoind data directory, so the wallet databases are copied while bitcoind runs, without backupwallet. Same fix shape as above: stop the service or use the daemon's own backup call. LLM review (Kimi K3 max, GLM 5.3 max, GPT-6 Astra xhigh) flagged this. I verified it against the code.
Activity
ostermayer commentedon Oct 17, 2026
Astra's grading of a later run on the same commit pointed at one more live copy.
modules/backups.nixline 63 includes the whole bitcoind data directory, so the wallet databases are copied while bitcoind runs, withoutbackupwallet. Same fix shape as above: stop the service or use the daemon's own backup call. LLM review (Kimi K3 max, GLM 5.3 max, GPT-6 Astra xhigh) flagged this. I verified it against the code.backups: exclude channel databases and let bitcoind copy its wallets
backups: exclude channel databases and let bitcoind copy its wallets
backups: exclude channel databases and let bitcoind copy its wallets (b…