@ -3073,30 +3073,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
@@ -3073,30 +3073,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
if ( pindexFork ! = pindexNewTip ) {
uiInterface . NotifyBlockTip ( fInitialDownload , pindexNewTip ) ;
if ( ! fInitialDownload ) {
// Find the hashes of all blocks that weren't previously in the best chain.
std : : vector < uint256 > vHashes ;
CBlockIndex * pindexToAnnounce = pindexNewTip ;
while ( pindexToAnnounce ! = pindexFork ) {
vHashes . push_back ( pindexToAnnounce - > GetBlockHash ( ) ) ;
pindexToAnnounce = pindexToAnnounce - > pprev ;
if ( vHashes . size ( ) = = MAX_BLOCKS_TO_ANNOUNCE ) {
// Limit announcements in case of a huge reorganization.
// Rely on the peer's synchronization mechanism in that case.
break ;
}
}
// Relay inventory, but don't relay old inventory during initial block download.
if ( connman ) {
connman - > ForEachNode ( [ nNewHeight , & vHashes ] ( CNode * pnode ) {
if ( nNewHeight > ( pnode - > nStartingHeight ! = - 1 ? pnode - > nStartingHeight - 2000 : 0 ) ) {
BOOST_REVERSE_FOREACH ( const uint256 & hash , vHashes ) {
pnode - > PushBlockHash ( hash ) ;
}
}
} ) ;
}
}
// Notify external listeners about the new tip.
GetMainSignals ( ) . UpdatedBlockTip ( pindexNewTip , pindexFork , fInitialDownload ) ;
}
@ -4682,6 +4658,38 @@ std::string GetWarnings(const std::string& strFor)
@@ -4682,6 +4658,38 @@ std::string GetWarnings(const std::string& strFor)
//////////////////////////////////////////////////////////////////////////////
//
// blockchain -> download logic notification
//
void PeerLogicValidation : : UpdatedBlockTip ( const CBlockIndex * pindexNew , const CBlockIndex * pindexFork , bool fInitialDownload ) {
const int nNewHeight = pindexNew - > nHeight ;
if ( ! fInitialDownload ) {
// Find the hashes of all blocks that weren't previously in the best chain.
std : : vector < uint256 > vHashes ;
const CBlockIndex * pindexToAnnounce = pindexNew ;
while ( pindexToAnnounce ! = pindexFork ) {
vHashes . push_back ( pindexToAnnounce - > GetBlockHash ( ) ) ;
pindexToAnnounce = pindexToAnnounce - > pprev ;
if ( vHashes . size ( ) = = MAX_BLOCKS_TO_ANNOUNCE ) {
// Limit announcements in case of a huge reorganization.
// Rely on the peer's synchronization mechanism in that case.
break ;
}
}
// Relay inventory, but don't relay old inventory during initial block download.
connman - > ForEachNode ( [ nNewHeight , & vHashes ] ( CNode * pnode ) {
if ( nNewHeight > ( pnode - > nStartingHeight ! = - 1 ? pnode - > nStartingHeight - 2000 : 0 ) ) {
BOOST_REVERSE_FOREACH ( const uint256 & hash , vHashes ) {
pnode - > PushBlockHash ( hash ) ;
}
}
} ) ;
}
}
//////////////////////////////////////////////////////////////////////////////
//
// Messages