diff options
author | Cozz Lovan <cozzlovan@yahoo.com> | 2014-08-10 18:01:55 +0200 |
---|---|---|
committer | Cozz Lovan <cozzlovan@yahoo.com> | 2014-08-31 16:17:39 +0200 |
commit | d920f7dcf876f5bb5c525a55c56028fcf65cbdf1 (patch) | |
tree | a774c421f5c32a4bac2510e7946e174853d0576f /src/main.cpp | |
parent | 9f3d47677973cb894fdbb437b9b322e2062a1bf1 (diff) |
Move g_signals.SetBestChain(..) below SyncWithWallets
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index da00b4b531..e206071910 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1773,11 +1773,6 @@ bool static WriteChainState(CValidationState &state) { void static UpdateTip(CBlockIndex *pindexNew) { chainActive.SetTip(pindexNew); - // Update best block in wallet (so we can detect restored wallets) - bool fIsInitialDownload = IsInitialBlockDownload(); - if ((chainActive.Height() % 20160) == 0 || (!fIsInitialDownload && (chainActive.Height() % 144) == 0)) - g_signals.SetBestChain(chainActive.GetLocator()); - // New best block nTimeBestReceived = GetTime(); mempool.AddTransactionsUpdated(1); @@ -1790,7 +1785,7 @@ void static UpdateTip(CBlockIndex *pindexNew) { cvBlockChange.notify_all(); // Check the version of the last 100 blocks to see if we need to upgrade: - if (!fIsInitialDownload) + if (!IsInitialBlockDownload()) { int nUpgraded = 0; const CBlockIndex* pindex = chainActive.Tip(); @@ -1907,6 +1902,11 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * BOOST_FOREACH(const CTransaction &tx, pblock->vtx) { SyncWithWallets(tx, pblock); } + // Update best block in wallet (so we can detect restored wallets) + // Emit this signal after the SyncWithWallets signals as the wallet relies on that everything up to this point has been synced + if ((chainActive.Height() % 20160) == 0 || ((chainActive.Height() % 144) == 0 && !IsInitialBlockDownload())) + g_signals.SetBestChain(chainActive.GetLocator()); + int64_t nTime6 = GetTimeMicros(); nTimePostConnect += nTime6 - nTime5; nTimeTotal += nTime6 - nTime1; LogPrint("bench", " - Connect postprocess: %.2fms [%.2fs]\n", (nTime6 - nTime5) * 0.001, nTimePostConnect * 0.000001); LogPrint("bench", "- Connect block: %.2fms [%.2fs]\n", (nTime6 - nTime1) * 0.001, nTimeTotal * 0.000001); |