Skip to content

Commit d8670fb

Browse files
committed
Move all calls to CheckBlockIndex out of net-processing logic
This will result in many more calls to CheckBlockIndex when connecting a list of headers (eg in ::HEADERS messages processing) but its only enabled in debug mode, and that should mostly just be during IBD, so it should be OK.
1 parent d6ea737 commit d8670fb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,6 +3675,8 @@ static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state
36753675
if (ppindex)
36763676
*ppindex = pindex;
36773677

3678+
CheckBlockIndex(chainparams.GetConsensus());
3679+
36783680
return true;
36793681
}
36803682

@@ -5827,8 +5829,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
58275829
return ProcessMessage(pfrom, NetMsgType::HEADERS, vHeadersMsg, nTimeReceived, chainparams, connman);
58285830
}
58295831
}
5830-
5831-
CheckBlockIndex(chainparams.GetConsensus());
58325832
}
58335833

58345834
else if (strCommand == NetMsgType::BLOCKTXN && !fImporting && !fReindex) // Ignore blocks received while importing
@@ -6025,8 +6025,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
60256025
}
60266026
}
60276027
}
6028-
6029-
CheckBlockIndex(chainparams.GetConsensus());
60306028
}
60316029

60326030
NotifyHeaderTip();

0 commit comments

Comments
 (0)