diff --git a/src/chainparams.cpp b/src/chainparams.cpp --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -246,7 +246,7 @@ // UNIX timestamp of last known number of transactions. 1522608016, // Total number of transactions between genesis and that timestamp - // (the tx=... number in the SetBestChain debug.log lines) + // (the tx=... number in the ChainStateFlushed debug.log lines) 248589038, // Estimated number of transactions per second after that timestamp. 3.2}; diff --git a/src/index/txindex.h b/src/index/txindex.h --- a/src/index/txindex.h +++ b/src/index/txindex.h @@ -55,7 +55,7 @@ const CBlockIndex *pindex, const std::vector &txn_conflicted) override; - void SetBestChain(const CBlockLocator &locator) override; + void ChainStateFlushed(const CBlockLocator &locator) override; public: /// Constructs the TxIndex, which becomes available to be queried. diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -189,7 +189,7 @@ } } -void TxIndex::SetBestChain(const CBlockLocator &locator) { +void TxIndex::ChainStateFlushed(const CBlockLocator &locator) { if (!m_synced) { return; } @@ -207,7 +207,7 @@ return; } - // This checks that SetBestChain callbacks are received after + // This checks that ChainStateFlushed callbacks are received after // BlockConnected. The check may fail immediately after the the sync thread // catches up and sets m_synced. Consider the case where there is a reorg // and the blocks on the stale branch are in the ValidationInterface queue diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -226,8 +226,8 @@ DumpMempool(); } - // FlushStateToDisk generates a SetBestChain callback, which we should avoid - // missing + // FlushStateToDisk generates a ChainStateFlushed callback, which we should + // avoid missing if (pcoinsTip != nullptr) { FlushStateToDisk(); } diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2177,7 +2177,7 @@ nNow > nLastSetChain + (int64_t)DATABASE_WRITE_INTERVAL * 1000000)) { // Update best block in wallet (so we can detect restored wallets). - GetMainSignals().SetBestChain(chainActive.GetLocator()); + GetMainSignals().ChainStateFlushed(chainActive.GetLocator()); nLastSetChain = nNow; } } catch (const std::runtime_error &e) { diff --git a/src/validationinterface.h b/src/validationinterface.h --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -98,7 +98,7 @@ virtual void BlockDisconnected(const std::shared_ptr &block) { } /** Notifies listeners of the new active block chain on-disk. */ - virtual void SetBestChain(const CBlockLocator &locator) {} + virtual void ChainStateFlushed(const CBlockLocator &locator) {} /** Notifies listeners about an inventory item being seen on the network. */ virtual void Inventory(const uint256 &hash) {} /** Tells listeners to broadcast their data. */ @@ -164,7 +164,7 @@ const CBlockIndex *pindex, const std::vector &); void BlockDisconnected(const std::shared_ptr &); - void SetBestChain(const CBlockLocator &); + void ChainStateFlushed(const CBlockLocator &); void Inventory(const uint256 &); void Broadcast(int64_t nBestBlockTime, CConnman *connman); void BlockChecked(const CBlock &, const CValidationState &); diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp --- a/src/validationinterface.cpp +++ b/src/validationinterface.cpp @@ -32,7 +32,7 @@ BlockDisconnected; boost::signals2::signal TransactionRemovedFromMempool; - boost::signals2::signal SetBestChain; + boost::signals2::signal ChainStateFlushed; boost::signals2::signal Inventory; boost::signals2::signal Broadcast; @@ -100,8 +100,8 @@ boost::bind(&CValidationInterface::BlockDisconnected, pwalletIn, _1)); g_signals.m_internals->TransactionRemovedFromMempool.connect(boost::bind( &CValidationInterface::TransactionRemovedFromMempool, pwalletIn, _1)); - g_signals.m_internals->SetBestChain.connect( - boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); + g_signals.m_internals->ChainStateFlushed.connect( + boost::bind(&CValidationInterface::ChainStateFlushed, pwalletIn, _1)); g_signals.m_internals->Inventory.connect( boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); g_signals.m_internals->Broadcast.connect(boost::bind( @@ -119,8 +119,8 @@ &CValidationInterface::ResendWalletTransactions, pwalletIn, _1, _2)); g_signals.m_internals->Inventory.disconnect( boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); - g_signals.m_internals->SetBestChain.disconnect( - boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); + g_signals.m_internals->ChainStateFlushed.disconnect( + boost::bind(&CValidationInterface::ChainStateFlushed, pwalletIn, _1)); g_signals.m_internals->TransactionAddedToMempool.disconnect(boost::bind( &CValidationInterface::TransactionAddedToMempool, pwalletIn, _1)); g_signals.m_internals->BlockConnected.disconnect(boost::bind( @@ -142,7 +142,7 @@ g_signals.m_internals->BlockChecked.disconnect_all_slots(); g_signals.m_internals->Broadcast.disconnect_all_slots(); g_signals.m_internals->Inventory.disconnect_all_slots(); - g_signals.m_internals->SetBestChain.disconnect_all_slots(); + g_signals.m_internals->ChainStateFlushed.disconnect_all_slots(); g_signals.m_internals->TransactionAddedToMempool.disconnect_all_slots(); g_signals.m_internals->BlockConnected.disconnect_all_slots(); g_signals.m_internals->BlockDisconnected.disconnect_all_slots(); @@ -193,8 +193,8 @@ m_internals->BlockDisconnected(pblock); } -void CMainSignals::SetBestChain(const CBlockLocator &locator) { - m_internals->SetBestChain(locator); +void CMainSignals::ChainStateFlushed(const CBlockLocator &locator) { + m_internals->ChainStateFlushed(locator); } void CMainSignals::Inventory(const uint256 &hash) { diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1090,7 +1090,7 @@ bool IsAllFromMe(const CTransaction &tx, const isminefilter &filter) const; Amount GetCredit(const CTransaction &tx, const isminefilter &filter) const; Amount GetChange(const CTransaction &tx) const; - void SetBestChain(const CBlockLocator &loc) override; + void ChainStateFlushed(const CBlockLocator &loc) override; DBErrors LoadWallet(bool &fFirstRunRet); DBErrors ZapWalletTx(std::vector &vWtx); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -486,7 +486,7 @@ return false; } -void CWallet::SetBestChain(const CBlockLocator &loc) { +void CWallet::ChainStateFlushed(const CBlockLocator &loc) { CWalletDB walletdb(*dbw); walletdb.WriteBestBlock(loc); } @@ -4296,7 +4296,7 @@ return nullptr; } - walletInstance->SetBestChain(chainActive.GetLocator()); + walletInstance->ChainStateFlushed(chainActive.GetLocator()); } else if (gArgs.IsArgSet("-usehd")) { bool useHD = gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET); if (walletInstance->IsHDEnabled() && !useHD) { @@ -4378,7 +4378,7 @@ reserver, true); } LogPrintf(" rescan %15dms\n", GetTimeMillis() - nStart); - walletInstance->SetBestChain(chainActive.GetLocator()); + walletInstance->ChainStateFlushed(chainActive.GetLocator()); walletInstance->dbw->IncrementUpdateCounter(); // Restore wallet transaction metadata after -zapwallettxes=1