Skip to content

Remove last_synced_height from cbf - #7

Merged
febyeji merged 1 commit into
febyeji:add-cbf-chain-sourcefrom
randomlogin:use-synced-height
Apr 1, 2026
Merged

Remove last_synced_height from cbf#7
febyeji merged 1 commit into
febyeji:add-cbf-chain-sourcefrom
randomlogin:use-synced-height

Conversation

@randomlogin

Copy link
Copy Markdown
Collaborator
  • Removed in-memory last_onchain_synced_height, last_lightning_synced_height, and lightning_scripts_dirty fields from CbfChainSource and CbfEventState
  • Added REORG_SAFETY_BLOCKS = 7 constant (matching bdk-kyoto's IMPOSSIBLE_REORG_DEPTH)
  • On-chain wallet skip height now derived from onchain_wallet.latest_checkpoint().height().checked_sub(REORG_SAFETY_BLOCKS) — BDK's persisted checkpoint
  • Lightning wallet skip height now derived from channel_manager.current_best_block().height.checked_sub(REORG_SAFETY_BLOCKS) — LDK's persisted best block
  • Simplified reorg handler (no height reset needed since skip heights come from persisted state)
  • Removed scripts_dirty tracking from register_tx/register_output
  • Tests use CBF sync config with 1 required peer

closes #6

Previously we tracked synced height and also had dirty flag for rescan
which was made from the genesis block. This was removed in favor of
block heights from channel manager and onchain wallet.

Safety reorg interval of 7 blocks (look-back) is added.

Force tests use CBF config with 1 required peers, as otherwise it would
die if one of two required peers went offline (which made impossible
testing of scenarios with 2 nodes on which goes offline).
@febyeji
febyeji merged commit 7b878ef into febyeji:add-cbf-chain-source Apr 1, 2026
13 of 19 checks passed
@randomlogin
randomlogin deleted the use-synced-height branch April 1, 2026 11:24
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