* CChain implementation */
| 9 | * CChain implementation |
| 10 | */ |
| 11 | void CChain::SetTip(CBlockIndex *pindex) { |
| 12 | if (pindex == nullptr) { |
| 13 | vChain.clear(); |
| 14 | return; |
| 15 | } |
| 16 | vChain.resize(pindex->nHeight + 1); |
| 17 | while (pindex && vChain[pindex->nHeight] != pindex) { |
| 18 | vChain[pindex->nHeight] = pindex; |
| 19 | pindex = pindex->pprev; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const { |
| 24 | int nStep = 1; |