Merge #13199: Bugfix: ensure consistency of m_failed_blocks after reconsiderblock

11fa6bb66e Bugfix: ensure consistency of m_failed_blocks after reconsiderblock (Suhas Daftuar)

Pull request description:

  This was introduced in 015a5258ad and could cause a node to crash (due to assertion failure) when using the `reconsiderblock` rpc.

Tree-SHA512: 820dcd761bf983e36f5d0f16777ed75c833daaf62a6b3a4dbd17f6caaf9287223e3a202d06540ac62f8ba72926b73b0873bb76c6273ddcb19d9408f4c1cd325e
This commit is contained in:
Pieter Wuille 2018-05-12 11:24:36 -07:00
commit 418ae49ee1
No known key found for this signature in database
GPG key ID: A636E97631F767E0

View file

@ -2841,6 +2841,7 @@ bool CChainState::ResetBlockFailureFlags(CBlockIndex *pindex) {
if (pindex->nStatus & BLOCK_FAILED_MASK) { if (pindex->nStatus & BLOCK_FAILED_MASK) {
pindex->nStatus &= ~BLOCK_FAILED_MASK; pindex->nStatus &= ~BLOCK_FAILED_MASK;
setDirtyBlockIndex.insert(pindex); setDirtyBlockIndex.insert(pindex);
m_failed_blocks.erase(pindex);
} }
pindex = pindex->pprev; pindex = pindex->pprev;
} }