Skip to content

Commit 1e59acd

Browse files
committed
validation: only call UpdatedBlockTip for active chainstate
This notification isn't needed for background chainstates. `kernel::Notifications::blockTip` are also skipped.
1 parent c6af23c commit 1e59acd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3263,7 +3263,7 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
32633263

32643264
// Notify external listeners about the new tip.
32653265
// Enqueue while holding cs_main to ensure that UpdatedBlockTip is called in the order in which blocks are connected
3266-
if (pindexFork != pindexNewTip) {
3266+
if (this == &m_chainman.ActiveChainstate() && pindexFork != pindexNewTip) {
32673267
// Notify ValidationInterface subscribers
32683268
GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, still_in_ibd);
32693269

src/validationinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class CValidationInterface {
8787
* but may not be called on every intermediate tip. If the latter behavior is desired,
8888
* subscribe to BlockConnected() instead.
8989
*
90-
* Called on a background thread.
90+
* Called on a background thread. Only called for the active chainstate.
9191
*/
9292
virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
9393
/**

0 commit comments

Comments
 (0)