Make condition closer to original, Fix incorrect comment.

This commit is contained in:
Kris Nuttycombe 2020-04-06 14:48:25 -06:00
parent 2013b35e3e
commit db65d92df4
1 changed files with 5 additions and 5 deletions

View File

@ -3213,7 +3213,6 @@ uint64_t nNotifiedSequence = 0;
bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock)
{
assert(pblock && pindexNew->pprev == chainActive.Tip());
// Read block from disk.
int64_t nTime1 = GetTimeMicros();
// Apply the block atomically to the chain state.
int64_t nTime2 = GetTimeMicros(); nTimeReadFromDisk += nTime2 - nTime1;
@ -3425,14 +3424,15 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
// Connect new blocks.
BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) {
const CBlock* pconnectBlock = pblock;
const CBlock* pconnectBlock;
CBlock block;
if (pindexConnect != pindexMostWork) {
if (pindexConnect == pindexMostWork) {
pconnectBlock = pblock;
} else {
// read the block to be connected from disk
if (!ReadBlockFromDisk(block, pindexConnect, chainparams.GetConsensus()))
return AbortNode(state, "Failed to read block");
pconnectBlock = █
} else {
pconnectBlock = pblock;
}
if (!ConnectTip(state, chainparams, pindexConnect, pconnectBlock)) {