MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / LoadAssumeutxoChainstate

Method LoadAssumeutxoChainstate

src/validation.cpp:6170–6187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6168}
6169
6170Chainstate* ChainstateManager::LoadAssumeutxoChainstate()
6171{
6172 assert(!CurrentChainstate().m_from_snapshot_blockhash);
6173 std::optional<fs::path> path = node::FindAssumeutxoChainstateDir(m_options.datadir);
6174 if (!path) {
6175 return nullptr;
6176 }
6177 std::optional<uint256> base_blockhash = node::ReadSnapshotBaseBlockhash(*path);
6178 if (!base_blockhash) {
6179 return nullptr;
6180 }
6181 LogInfo("[snapshot] detected active snapshot chainstate (%s) - loading",
6182 fs::PathToString(*path));
6183
6184 auto snapshot_chainstate{std::make_unique<Chainstate>(nullptr, m_blockman, *this, base_blockhash)};
6185 LogInfo("[snapshot] switching active chainstate to %s", snapshot_chainstate->ToString());
6186 return &this->AddChainstate(std::move(snapshot_chainstate));
6187}
6188
6189Chainstate& ChainstateManager::AddChainstate(std::unique_ptr<Chainstate> chainstate)
6190{

Callers 1

LoadChainstateFunction · 0.80

Calls 4

PathToStringFunction · 0.85
ToStringMethod · 0.45

Tested by

no test coverage detected