Skip to content

Fix satoshi startup block sync backfill#446

Merged
macterra merged 1 commit intomainfrom
fix-satoshi-sync-backfill
Apr 17, 2026
Merged

Fix satoshi startup block sync backfill#446
macterra merged 1 commit intomainfrom
fix-satoshi-sync-backfill

Conversation

@macterra
Copy link
Copy Markdown
Collaborator

Summary

Fix satoshi mediator startup sync so it does not treat the latest stored block height as proof that the full configured range has been backfilled.

What changed

  • resume startup sync from latest.height + 1 instead of re-adding the latest known block
  • skip cleanly when the configured start block is ahead of the current chain tip
  • detect partial backfills by verifying the configured start block exists in gatekeeper before declaring sync complete
  • report sync progress as a percentage of the configured range from start block to current height

Why

Gatekeeper can contain a recent tail of BTC mainnet blocks without having the full range from the configured start block. In that case the old logic would see the latest stored height at tip and incorrectly skip the missing historical backfill.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the Satoshi mediator’s startup block-sync logic so it correctly backfills the full configured block range (from config.startBlock) instead of assuming that reaching the chain tip implies historical coverage in Gatekeeper.

Changes:

  • Resume sync from latest.height + 1 when a complete backfill is detected (avoid re-adding the latest stored block).
  • Skip startup sync when config.startBlock is ahead of the current chain tip, and detect partial backfills by verifying the configured start block exists in Gatekeeper.
  • Add a helper to report sync progress as a percentage of the configured range (startBlock..tip) and use it in both sync paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@macterra macterra merged commit fe2f482 into main Apr 17, 2026
29 checks passed
@macterra macterra deleted the fix-satoshi-sync-backfill branch April 17, 2026 17:37
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