mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 06:39:15 +02:00
validation: add RecalculateBestHeader() function
It recalculates m_best_header by looping over the entire block index. Even though this is not very performant, it will only be used in rare situations that cannot be triggered by others without a cost: As part of to invalidateblock / reconsiderblock rpcs, or when a block with an accepted header with valid PoW turns out to be invalid later during full validation.
This commit is contained in:
@@ -1321,6 +1321,11 @@ public:
|
||||
//! nullopt.
|
||||
std::optional<int> GetSnapshotBaseHeight() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
//! If, due to invalidation / reconsideration of blocks, the previous
|
||||
//! best header is no longer valid / guaranteed to be the most-work
|
||||
//! header in our block-index not known to be invalid, recalculate it.
|
||||
void RecalculateBestHeader() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
|
||||
|
||||
CCheckQueue<CScriptCheck>& GetCheckQueue() { return m_script_check_queue; }
|
||||
|
||||
~ChainstateManager();
|
||||
|
||||
Reference in New Issue
Block a user