Skip to content

Commit

Permalink
Move the new valid block signal to the end of accept block
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed Oct 30, 2024
1 parent 2ca33e4 commit 44dc49f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6085,9 +6085,6 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr<const CBlock>& pblock,
return error("%s: %s", __func__, state.ToString());
}

// Header is valid/has work, merkle tree and segwit merkle tree are good...RELAY NOW
// (but if it does not build on our best tip, let the SendMessages loop relay it)

// Write block to history file
if (fNewBlock) *fNewBlock = true;
try {
Expand All @@ -6112,6 +6109,11 @@ bool ChainstateManager::AcceptBlock(const std::shared_ptr<const CBlock>& pblock,

CheckBlockIndex();

// Header is valid/has work, merkle tree and segwit merkle tree are good...RELAY NOW
// (but if it does not build on our best tip, let the SendMessages loop relay it)
if (!IsInitialBlockDownload() && ActiveTip() == pindex->pprev)
GetMainSignals().NewPoWValidBlock(pindex, pblock);

return true;
}

Expand Down

0 comments on commit 44dc49f

Please sign in to comment.