| 6250 | } |
| 6251 | |
| 6252 | bool ChainstateManager::DeleteChainstate(Chainstate& chainstate) |
| 6253 | { |
| 6254 | AssertLockHeld(::cs_main); |
| 6255 | assert(!chainstate.m_coins_views); |
| 6256 | const fs::path db_path{chainstate.StoragePath()}; |
| 6257 | if (!DeleteCoinsDBFromDisk(db_path, /*is_snapshot=*/bool{chainstate.m_from_snapshot_blockhash})) { |
| 6258 | LogError("Deletion of %s failed. Please remove it manually to continue reindexing.", |
| 6259 | fs::PathToString(db_path)); |
| 6260 | return false; |
| 6261 | } |
| 6262 | std::unique_ptr<Chainstate> prev_chainstate{Assert(RemoveChainstate(chainstate))}; |
| 6263 | Chainstate& curr_chainstate{CurrentChainstate()}; |
| 6264 | assert(prev_chainstate->m_mempool->size() == 0); |
| 6265 | assert(!curr_chainstate.m_mempool); |
| 6266 | std::swap(curr_chainstate.m_mempool, prev_chainstate->m_mempool); |
| 6267 | return true; |
| 6268 | } |
| 6269 | |
| 6270 | ChainstateRole Chainstate::GetRole() const |
| 6271 | { |
no test coverage detected