HomePhabricator

validation: Don't load a snapshot if it's not in the best header chain.

Description

validation: Don't load a snapshot if it's not in the best header chain.

Summary:
If the snapshot is not an ancestor of the most-work header (m_best_header),
syncing from that alternative chain should be prioritised.
Therefore don't accept loading a snapshot in this situation.

If that other chain turns out to be invalid, m_best_header
would be reset and loading the snapshot should be possible again.

Because of the work required to generate a conflicting headers chain,
this should only be possible under extreme circumstances, such as major forks.

This is a backport of core#30320

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18059

Details

Provenance
Martin Zumsande <mzumsande@gmail.com>Authored on Jun 20 2024, 20:14
PiRKCommitted on Thu, May 8, 09:04
PiRKPushed on Thu, May 8, 09:04
Reviewer
Restricted Project
Differential Revision
D18059: validation: Don't load a snapshot if it's not in the best header chain.
Parents
rABCc5564148fabb: Add missing cstdint header
Branches
Unknown
Tags
Unknown