mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
rebuild index when switching chains
This commit is contained in:
parent
2e6eb9f2b6
commit
143c80789c
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user