mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-11 16:17:54 +02:00
chain: add CChain::IsTipRecent helper
Factor the chain tip work/recency check out of `ChainstateManager::IsInitialBlockDownload()` into a reusable `CChain::IsTipRecent()` helper, and annotate it as requiring `cs_main` since it's reading mutable state. Also introduce a local `chainman_ref` in the kernel import-blocks wrapper to reduce repetition and keep follow-up diffs small. `IsInitialBlockDownload` returns were also unified to make the followup move clean. Co-authored-by: Patrick Strateman <patrick.strateman@gmail.com> Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
This commit is contained in:
@@ -1054,7 +1054,8 @@ int btck_chainstate_manager_import_blocks(btck_ChainstateManager* chainman, cons
|
||||
import_files.emplace_back(std::string{block_file_paths_data[i], block_file_paths_lens[i]}.c_str());
|
||||
}
|
||||
}
|
||||
node::ImportBlocks(*btck_ChainstateManager::get(chainman).m_chainman, import_files);
|
||||
auto& chainman_ref{*btck_ChainstateManager::get(chainman).m_chainman};
|
||||
node::ImportBlocks(chainman_ref, import_files);
|
||||
} catch (const std::exception& e) {
|
||||
LogError("Failed to import blocks: %s", e.what());
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user