|
|
|
@ -3028,7 +3028,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
|
|
|
|
const CBlockIndex *pindexFork;
|
|
|
|
|
std::list<CTransaction> txConflicted;
|
|
|
|
|
bool fInitialDownload;
|
|
|
|
|
int nNewHeight;
|
|
|
|
|
{
|
|
|
|
|
LOCK(cs_main);
|
|
|
|
|
CBlockIndex *pindexOldTip = chainActive.Tip();
|
|
|
|
@ -3051,13 +3050,10 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
|
|
|
|
pindexNewTip = chainActive.Tip();
|
|
|
|
|
pindexFork = chainActive.FindFork(pindexOldTip);
|
|
|
|
|
fInitialDownload = IsInitialBlockDownload();
|
|
|
|
|
nNewHeight = chainActive.Height();
|
|
|
|
|
}
|
|
|
|
|
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
|
|
|
|
|
|
|
|
|
|
// Notifications/callbacks that can run without cs_main
|
|
|
|
|
if(connman)
|
|
|
|
|
connman->SetBestHeight(nNewHeight);
|
|
|
|
|
|
|
|
|
|
// throw all transactions though the signal-interface
|
|
|
|
|
// while _not_ holding the cs_main lock
|
|
|
|
@ -3069,12 +3065,12 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
|
|
|
|
|
for(unsigned int i = 0; i < txChanged.size(); i++)
|
|
|
|
|
SyncWithWallets(std::get<0>(txChanged[i]), std::get<1>(txChanged[i]), std::get<2>(txChanged[i]));
|
|
|
|
|
|
|
|
|
|
// Notify external listeners about the new tip.
|
|
|
|
|
GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, fInitialDownload);
|
|
|
|
|
|
|
|
|
|
// Always notify the UI if a new block tip was connected
|
|
|
|
|
if (pindexFork != pindexNewTip) {
|
|
|
|
|
uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip);
|
|
|
|
|
|
|
|
|
|
// Notify external listeners about the new tip.
|
|
|
|
|
GetMainSignals().UpdatedBlockTip(pindexNewTip, pindexFork, fInitialDownload);
|
|
|
|
|
}
|
|
|
|
|
} while (pindexNewTip != pindexMostWork);
|
|
|
|
|
CheckBlockIndex(chainparams.GetConsensus());
|
|
|
|
@ -4665,6 +4661,7 @@ std::string GetWarnings(const std::string& strFor)
|
|
|
|
|
|
|
|
|
|
void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {
|
|
|
|
|
const int nNewHeight = pindexNew->nHeight;
|
|
|
|
|
connman->SetBestHeight(nNewHeight);
|
|
|
|
|
|
|
|
|
|
if (!fInitialDownload) {
|
|
|
|
|
// Find the hashes of all blocks that weren't previously in the best chain.
|
|
|
|
|