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