Browse Source

Workaround bridgekeeper issue

pull/454/head
miketout 2 years ago
parent
commit
f6f2603373
  1. 8
      src/main.cpp
  2. 22
      src/pbaas/notarization.cpp

8
src/main.cpp

@ -5384,7 +5384,7 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
{
CBlockIndex *tipindex;
fprintf(stderr,">>>>>>>>>>> rewind start ht.%d -> KOMODO_REWIND.%d\n",chainActive.LastTip()->GetHeight(),KOMODO_REWIND);
while ( KOMODO_REWIND > 0 && (tipindex= chainActive.LastTip()) != 0 && tipindex->GetHeight() > KOMODO_REWIND )
while ( KOMODO_REWIND > 0 && (tipindex = chainActive.LastTip()) != 0 && tipindex->GetHeight() > KOMODO_REWIND )
{
fBlocksDisconnected = true;
fprintf(stderr,"%d ",(int32_t)tipindex->GetHeight());
@ -5396,7 +5396,11 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
sleep(20);
fprintf(stderr,"resuming normal operations\n");
KOMODO_REWIND = 0;
//return(true);
if (pindexMostWork->GetHeight() > chainActive.Height())
{
pindexMostWork = pindexMostWork->GetAncestor(chainActive.Height());
}
pindexFork = chainActive.FindFork(pindexMostWork);
}
// Build list of new blocks to connect.
std::vector<CBlockIndex*> vpindexToConnect;

22
src/pbaas/notarization.cpp

@ -3682,10 +3682,28 @@ bool CPBaaSNotarization::ConfirmOrRejectNotarizations(CWallet *pWallet,
bool retVal = false;
int firstNotarizationIndex = -1;
LogPrint("notarization", "%s: proofRootArr: %s\n", __func__, proofRootArr.write().c_str());
// we seem to be getting an extra element at times
// TODO: HARDENING - fix this in bridgekeeper
if (proofRootArr.size() > bestFork.size())
{
UniValue tempArr(UniValue::VARR);
for (int i = 0; i < bestFork.size(); i++)
{
tempArr.push_back(proofRootArr[i]);
}
}
// look from the latest notarization that may qualify
for (int i = proofRootArr.size() - 1; i >= 0; i--)
for (int i = (proofRootArr.size() - 1); i >= 0; i--)
{
int idx = bestFork[uni_get_int(proofRootArr[i])];
int idx = uni_get_int(proofRootArr[i]);
if (idx >= bestFork.size())
{
continue;
}
idx = bestFork[idx];
auto proofIt = cnd.vtx[idx].second.proofRoots.find(ASSETCHAINS_CHAINID);

Loading…
Cancel
Save