rebuild index when switching chains

This commit is contained in:
Evan Duffield 2015-07-19 06:45:35 -07:00
parent 2e6eb9f2b6
commit 143c80789c

View File

@ -16,11 +16,18 @@ void CChain::SetTip(CBlockIndex *pindex) {
vChain.clear();
return;
}
int nChainSwitch = 0;
vChain.resize(pindex->nHeight + 1);
while (pindex && vChain[pindex->nHeight] != pindex) {
vChain[pindex->nHeight] = pindex;
pindex = pindex->pprev;
}
//recalculate the coinbase payee cache if needed
if(nChainSwitch > 1) {
coinbasePayee.BuildIndex(true);
}
}
CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const {