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