Page MenuHomePhabricator

assumeutxo cleanup: Move IsInitialBlockDownload & NotifyHeaderTip to ChainstateManager
Needs ReviewPublic

Authored by PiRK on Tue, Feb 4, 16:58.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

This change makes IsInitialBlockDownload and NotifyHeaderTip functions no
longer tied to individual Chainstate objects. It makes them work with the
ChainstateManager object instead so code is simpler and it is no longer
possible to call them incorrectly with an inactive Chainstate.

This change also makes m_cached_finished_ibd caching easier to reason about,
because now there is only one cached value instead of two (for background and
snapshot chainstates) so the cached IBD state now no longer gets reset when a
snapshot is loaded.

There should be no change in behavior because these functions were always
called on the active ChainState objects.

These changes were discussed previously
https://github.com/bitcoin/bitcoin/pull/27746#discussion_r1246868905 and
https://github.com/bitcoin/bitcoin/pull/27746#discussion_r1237552792 as
possible followups for that PR.

This is a backport of core#28218

Depends on D17605

Test Plan

ninja all check-all