| 3810 | } |
| 3811 | |
| 3812 | CBlockIndex * InsertBlockIndex(uint256 hash) |
| 3813 | { |
| 3814 | if (hash.IsNull()) |
| 3815 | return NULL; |
| 3816 | |
| 3817 | // Return existing |
| 3818 | BlockMap::iterator mi = mapBlockIndex.find(hash); |
| 3819 | if (mi != mapBlockIndex.end()) |
| 3820 | return (*mi).second; |
| 3821 | |
| 3822 | // Create new |
| 3823 | CBlockIndex* pindexNew = new CBlockIndex(); |
| 3824 | if (!pindexNew) |
| 3825 | throw runtime_error("LoadBlockIndex(): new CBlockIndex failed"); |
| 3826 | mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first; |
| 3827 | pindexNew->phashBlock = &((*mi).first); |
| 3828 | |
| 3829 | return pindexNew; |
| 3830 | } |
| 3831 | |
| 3832 | bool static LoadBlockIndexDB(bool* fRebuildRequired) |
| 3833 | { |
no test coverage detected