Skip to content

Add chain syncing via compact block filters (BIP 157)#828

Draft
febyeji wants to merge 10 commits intolightningdevkit:mainfrom
febyeji:add-cbf-chain-source
Draft

Add chain syncing via compact block filters (BIP 157)#828
febyeji wants to merge 10 commits intolightningdevkit:mainfrom
febyeji:add-cbf-chain-source

Conversation

@febyeji
Copy link

@febyeji febyeji commented Mar 15, 2026

Summary

Add chain syncing via compact block filters (BIP 157/158) using the bip157 crate. Related to the issue #767.

Note: I wasn't aware that there is a previous draft #821 when I finished this work. I'm happy to collaborate with @randomlogin to merge our efforts, whichever the maintainers prefer.

Introduces CbfChainSource: a new chain backend that syncs wallet and Lightning state through compact block filters over the Bitcoin P2P network.

Commits

Structured to build up the CBF backend layer by layer, with integration tests added alongside the features they exercise.

configuration surface (1)
→ core P2P lifecycle (2)
→ fee estimation (3)
→ on-chain sync pipeline (4–6)
→ Lightning integration (7)
→ reorg handling (8)
→ docs, tests, and bindings (9–11)

Design decisions

  • Fee estimation: Derived from coinbase rewards across multiple blocks: approximate but requires no trusted server (per Add chain syncing via bip157 crate #767 discussion)
  • Reorg handling: BDK checkpoint comparison → wallet revert → payment status update (Confirmed → Unconfirmed)
  • Sync modes: Manual (sync_wallets()) + optional background sync via BackgroundSyncConfig
  • CI: CBF tests run with --test-threads=1 (exclusive bitcoind P2P port access)

@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@febyeji febyeji force-pushed the add-cbf-chain-source branch 2 times, most recently from 2c0b1d8 to 2144477 Compare March 15, 2026 10:04
@febyeji febyeji force-pushed the add-cbf-chain-source branch from 2144477 to bc490b0 Compare March 16, 2026 05:55
@febyeji febyeji force-pushed the add-cbf-chain-source branch from bc490b0 to 6e39d0d Compare March 16, 2026 06:02
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

Successfully merging this pull request may close these issues.

2 participants