Skip to content

Comments

fix sending genesis blocks to peers in syncLoop#402

Merged
n8mgr merged 2 commits intomasterfrom
chris/not-on-best-chain-fix
Feb 24, 2026
Merged

fix sending genesis blocks to peers in syncLoop#402
n8mgr merged 2 commits intomasterfrom
chris/not-on-best-chain-fix

Conversation

@ChrisSchinnerl
Copy link
Member

The call to s.cm.History may return a history that is only partially filled in when it can't fetch blocks from the store. With instant syncing this is a real possibility.

We would then ask for the state of that empty block id which is the genesis state being stored with a height of math.MaxUint64 in the store. Sending that over to the peer will then show up as {"peer": "<-66.85.74.42:15724", "rpc": "SendHeaders", "error": "index 18446744073709551615::00000000 is not on our best chain"}.

@ChrisSchinnerl ChrisSchinnerl self-assigned this Feb 24, 2026
Copilot AI review requested due to automatic review settings February 24, 2026 10:11
@github-project-automation github-project-automation bot moved this to In Progress in Sia Feb 24, 2026
Copy link

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

This PR fixes a bug in the syncer's syncLoop function where empty BlockID entries in the history array could cause errors when attempting to send genesis blocks to peers during instant syncing scenarios.

Changes:

  • Added a check to skip empty BlockID entries when iterating through history returned by cm.History()
  • Prevents attempting to fetch state for empty block IDs, which would incorrectly trigger genesis state lookups with invalid heights

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

@n8mgr n8mgr merged commit a855c3d into master Feb 24, 2026
13 checks passed
@n8mgr n8mgr deleted the chris/not-on-best-chain-fix branch February 24, 2026 19:31
@github-project-automation github-project-automation bot moved this from In Progress to Done in Sia Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants