Skip to content

Commit 48ee837

Browse files
committed
[Refactoring] Set connman best height in UpdatedBlockTip
1 parent 3137b55 commit 48ee837

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2864,11 +2864,6 @@ bool ActivateBestChain(CValidationState& state, const CBlock* pblock, bool fAlre
28642864
break;
28652865
}
28662866

2867-
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
2868-
// Notifications/callbacks that can run without cs_main
2869-
if(connman)
2870-
connman->SetBestHeight(pindexNewTip->nHeight);
2871-
28722867
// Always notify the UI if a new block tip was connected
28732868
if (pindexFork != pindexNewTip) {
28742869

@@ -4667,9 +4662,13 @@ std::string GetWarnings(std::string strFor)
46674662

46684663
void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload)
46694664
{
4665+
const int nNewHeight = pindexNew->nHeight;
4666+
4667+
if(connman)
4668+
connman->SetBestHeight(nNewHeight);
4669+
46704670
if (!fInitialDownload) {
46714671
const uint256& hashNewTip = pindexNew->GetBlockHash();
4672-
const int nNewHeight = pindexNew->nHeight;
46734672
// Relay inventory, but don't relay old inventory during initial block download.
46744673
if (connman) {
46754674
connman->ForEachNode([nNewHeight, hashNewTip](CNode* pnode) {

0 commit comments

Comments
 (0)