| 6168 | } |
| 6169 | |
| 6170 | Chainstate* 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 | |
| 6189 | Chainstate& ChainstateManager::AddChainstate(std::unique_ptr<Chainstate> chainstate) |
| 6190 | { |
no test coverage detected