Merge branch 'dev' into danger

This commit is contained in:
Duke Leto
2022-07-12 08:32:06 -04:00
158 changed files with 24136 additions and 97 deletions

View File

@@ -2359,6 +2359,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW)
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
// fprintf(stderr,"%s: nHeight=%d\n", __func__, nHeight);
return hush_sc_block_subsidy(nHeight);
}
@@ -2403,7 +2404,9 @@ bool IsInitialBlockDownload()
{
LogPrintf("Leaving InitialBlockDownload (latching to false)\n");
latchToFalse.store(true, std::memory_order_relaxed);
} // else fprintf(stderr,"state.%d ht.%d vs %d, t.%u\n",state,(int32_t)chainActive.Height(),(uint32_t)ptr->GetHeight(),(int32_t)ptr->GetBlockTime());
} else {
fprintf(stderr,"%s: state.%d ht.%d vs %d, t.%u\n",__func__, state,(int32_t)chainActive.Height(),(uint32_t)ptr->GetHeight(),(int32_t)ptr->GetBlockTime());
}
return state;
}
@@ -2446,12 +2449,14 @@ static CBlockIndex *pindexBestForkBase = NULL;
void CheckForkWarningConditions()
{
//fprintf(stderr,"%s checking for IBD\n", __func__);
AssertLockHeld(cs_main);
// Before we get past initial download, we cannot reliably alert about forks
// (we assume we don't get stuck on a fork before finishing our initial sync)
if (IsInitialBlockDownload())
return;
//fprintf(stderr,"%s not in IBD\n", __func__);
// If our best fork is no longer within 288 blocks (+/- 12 hours if no one mines it)
// of our head, drop it
if (pindexBestForkTip && chainActive.Height() - pindexBestForkTip->GetHeight() >= 288)
@@ -2479,9 +2484,7 @@ void CheckForkWarningConditions()
CAlert::Notify(warning, true);
fLargeWorkInvalidChainFound = true;
}
}
else
{
} else {
fLargeWorkForkFound = false;
fLargeWorkInvalidChainFound = false;
}
@@ -5537,23 +5540,23 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
// NOTE: CheckBlockHeader is called by CheckBlock
if (!ContextualCheckBlockHeader(block, state, pindexPrev))
{
//fprintf(stderr,"TestBlockValidity failure A checkPOW.%d\n",fCheckPOW);
fprintf(stderr,"%s: failure A checkPOW=%d\n",__func__,fCheckPOW);
return false;
}
int32_t futureblock;
if (!CheckBlock(&futureblock,indexDummy.GetHeight(),0,block, state, verifier, fCheckPOW, fCheckMerkleRoot))
{
//fprintf(stderr,"TestBlockValidity failure B checkPOW.%d\n",fCheckPOW);
fprintf(stderr,"%s: failure B checkPOW=%d\n",__func__, fCheckPOW);
return false;
}
if (!ContextualCheckBlock(0,block, state, pindexPrev))
{
//fprintf(stderr,"TestBlockValidity failure C checkPOW.%d\n",fCheckPOW);
fprintf(stderr,"%s: failure C checkPOW=%d\n",__func__, fCheckPOW);
return false;
}
if (!ConnectBlock(block, state, &indexDummy, viewNew, true,fCheckPOW))
{
//fprintf(stderr,"TestBlockValidity failure D checkPOW.%d\n",fCheckPOW);
fprintf(stderr,"%s: failure D checkPOW=%d\n",__func__,fCheckPOW);
return false;
}
assert(state.IsValid());