Help human fix

This commit is contained in:
jl777
2018-09-24 05:45:38 -11:00
parent 12832b1d22
commit 63cadcf444

View File

@@ -3619,23 +3619,34 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
// our genesis block. In practice this (probably) won't happen because of checks elsewhere. // our genesis block. In practice this (probably) won't happen because of checks elsewhere.
auto reorgLength = pindexOldTip ? pindexOldTip->nHeight - (pindexFork ? pindexFork->nHeight : -1) : 0; auto reorgLength = pindexOldTip ? pindexOldTip->nHeight - (pindexFork ? pindexFork->nHeight : -1) : 0;
static_assert(MAX_REORG_LENGTH > 0, "We must be able to reorg some distance"); static_assert(MAX_REORG_LENGTH > 0, "We must be able to reorg some distance");
if (reorgLength > MAX_REORG_LENGTH) { if (reorgLength > MAX_REORG_LENGTH)
auto msg = strprintf(_( {
"A block chain reorganization has been detected that would roll back %d blocks! " int32_t notarizedht,prevMoMheight; uint256 notarizedhash,txid;
"This is larger than the maximum of %d blocks, and so the node is shutting down for your safety." notarizedht = komodo_notarized_height(&prevMoMheight,&notarizedhash,&txid);
), reorgLength, MAX_REORG_LENGTH) + "\n\n" + if ( pindexFork->nHeight < notarizedht )
_("Reorganization details") + ":\n" + {
"- " + strprintf(_("Current tip: %s, height %d, work %s"), fprintf(stderr,"pindexFork->nHeight.%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->nHeight,notarizedht);
pindexOldTip->phashBlock->GetHex(), pindexOldTip->nHeight, pindexOldTip->nChainWork.GetHex()) + "\n" + pindexFork = pindexOldTip;
"- " + strprintf(_("New tip: %s, height %d, work %s"), }
pindexMostWork->phashBlock->GetHex(), pindexMostWork->nHeight, pindexMostWork->nChainWork.GetHex()) + "\n" + else
"- " + strprintf(_("Fork point: %s %s, height %d"), {
ASSETCHAINS_SYMBOL,pindexFork->phashBlock->GetHex(), pindexFork->nHeight) + "\n\n" + auto msg = strprintf(_(
_("Please help, human!"); "A block chain reorganization has been detected that would roll back %d blocks! "
LogPrintf("*** %s\n", msg); "This is larger than the maximum of %d blocks, and so the node is shutting down for your safety."
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_ERROR); ), reorgLength, MAX_REORG_LENGTH) + "\n\n" +
StartShutdown(); _("Reorganization details") + ":\n" +
return false; "- " + strprintf(_("Current tip: %s, height %d, work %s"),
pindexOldTip->phashBlock->GetHex(), pindexOldTip->nHeight, pindexOldTip->nChainWork.GetHex()) + "\n" +
"- " + strprintf(_("New tip: %s, height %d, work %s"),
pindexMostWork->phashBlock->GetHex(), pindexMostWork->nHeight, pindexMostWork->nChainWork.GetHex()) + "\n" +
"- " + strprintf(_("Fork point: %s %s, height %d"),
ASSETCHAINS_SYMBOL,pindexFork->phashBlock->GetHex(), pindexFork->nHeight) + "\n\n" +
_("Please help, human!");
LogPrintf("*** %s\n", msg);
uiInterface.ThreadSafeMessageBox(msg, "", CClientUIInterface::MSG_ERROR);
StartShutdown();
return false;
}
} }
// Disconnect active blocks which are no longer in the best chain. // Disconnect active blocks which are no longer in the best chain.