Auto merge of #3166 - str4d:3132-reset-pindexbestinvalid, r=str4d
When rewinding, reset pindexBestInvalid if it is pointing to a removed block
This commit is contained in:
commit
b89b48cda1
|
@ -4058,6 +4058,10 @@ bool RewindBlockIndex(const CChainParams& params)
|
||||||
if (!sufficientlyValidated(pindexIter) && !chainActive.Contains(pindexIter)) {
|
if (!sufficientlyValidated(pindexIter) && !chainActive.Contains(pindexIter)) {
|
||||||
// Add to the list of blocks to remove
|
// Add to the list of blocks to remove
|
||||||
vBlocks.push_back(pindexIter);
|
vBlocks.push_back(pindexIter);
|
||||||
|
if (pindexIter == pindexBestInvalid) {
|
||||||
|
// Reset invalid block marker if it was pointing to this block
|
||||||
|
pindexBestInvalid = NULL;
|
||||||
|
}
|
||||||
// Update indices
|
// Update indices
|
||||||
setBlockIndexCandidates.erase(pindexIter);
|
setBlockIndexCandidates.erase(pindexIter);
|
||||||
auto ret = mapBlocksUnlinked.equal_range(pindexIter->pprev);
|
auto ret = mapBlocksUnlinked.equal_range(pindexIter->pprev);
|
||||||
|
|
Loading…
Reference in New Issue