| 4063 | } |
| 4064 | |
| 4065 | CBlockIndex * CChainState::InsertBlockIndex(const uint256& hash) |
| 4066 | { |
| 4067 | AssertLockHeld(cs_main); |
| 4068 | |
| 4069 | if (hash.IsNull()) |
| 4070 | return nullptr; |
| 4071 | |
| 4072 | // Return existing |
| 4073 | BlockMap::iterator mi = mapBlockIndex.find(hash); |
| 4074 | if (mi != mapBlockIndex.end()) |
| 4075 | return (*mi).second; |
| 4076 | |
| 4077 | // Create new |
| 4078 | CBlockIndex* pindexNew = new CBlockIndex(); |
| 4079 | mi = mapBlockIndex.insert(std::make_pair(hash, pindexNew)).first; |
| 4080 | pindexNew->phashBlock = &((*mi).first); |
| 4081 | |
| 4082 | return pindexNew; |
| 4083 | } |
| 4084 | |
| 4085 | bool CChainState::LoadBlockIndex(const Consensus::Params& consensus_params, CBlockTreeDB& blocktree) |
| 4086 | { |
no test coverage detected