Make condition closer to original, Fix incorrect comment.
This commit is contained in:
parent
2013b35e3e
commit
db65d92df4
10
src/main.cpp
10
src/main.cpp
|
@ -3213,7 +3213,6 @@ uint64_t nNotifiedSequence = 0;
|
||||||
bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock)
|
bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock)
|
||||||
{
|
{
|
||||||
assert(pblock && pindexNew->pprev == chainActive.Tip());
|
assert(pblock && pindexNew->pprev == chainActive.Tip());
|
||||||
// Read block from disk.
|
|
||||||
int64_t nTime1 = GetTimeMicros();
|
int64_t nTime1 = GetTimeMicros();
|
||||||
// Apply the block atomically to the chain state.
|
// Apply the block atomically to the chain state.
|
||||||
int64_t nTime2 = GetTimeMicros(); nTimeReadFromDisk += nTime2 - nTime1;
|
int64_t nTime2 = GetTimeMicros(); nTimeReadFromDisk += nTime2 - nTime1;
|
||||||
|
@ -3425,14 +3424,15 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
|
||||||
|
|
||||||
// Connect new blocks.
|
// Connect new blocks.
|
||||||
BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) {
|
BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) {
|
||||||
const CBlock* pconnectBlock = pblock;
|
const CBlock* pconnectBlock;
|
||||||
CBlock block;
|
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()))
|
if (!ReadBlockFromDisk(block, pindexConnect, chainparams.GetConsensus()))
|
||||||
return AbortNode(state, "Failed to read block");
|
return AbortNode(state, "Failed to read block");
|
||||||
pconnectBlock = █
|
pconnectBlock = █
|
||||||
} else {
|
|
||||||
pconnectBlock = pblock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ConnectTip(state, chainparams, pindexConnect, pconnectBlock)) {
|
if (!ConnectTip(state, chainparams, pindexConnect, pconnectBlock)) {
|
||||||
|
|
Loading…
Reference in New Issue