mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
[refactor] change ActiveTipChange to use CBlockIndex ref instead of ptr
This commit is contained in:
parent
7cc5ac5a67
commit
bce5f37c7b
4 changed files with 8 additions and 8 deletions
|
@ -489,7 +489,7 @@ public:
|
|||
CTxMemPool& pool, node::Warnings& warnings, Options opts);
|
||||
|
||||
/** Overridden from CValidationInterface. */
|
||||
void ActiveTipChange(const CBlockIndex* new_tip, bool) override
|
||||
void ActiveTipChange(const CBlockIndex& new_tip, bool) override
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
||||
void BlockConnected(ChainstateRole role, const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected) override
|
||||
EXCLUSIVE_LOCKS_REQUIRED(!m_tx_download_mutex);
|
||||
|
@ -2070,7 +2070,7 @@ void PeerManagerImpl::StartScheduledTasks(CScheduler& scheduler)
|
|||
scheduler.scheduleFromNow([&] { ReattemptInitialBroadcast(scheduler); }, delta);
|
||||
}
|
||||
|
||||
void PeerManagerImpl::ActiveTipChange(const CBlockIndex* new_tip, bool is_ibd)
|
||||
void PeerManagerImpl::ActiveTipChange(const CBlockIndex& new_tip, bool is_ibd)
|
||||
{
|
||||
AssertLockNotHeld(m_mempool.cs);
|
||||
AssertLockNotHeld(m_tx_download_mutex);
|
||||
|
|
|
@ -3553,7 +3553,7 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr<
|
|||
} // release MempoolMutex
|
||||
// Notify external listeners about the new tip, even if pindexFork == pindexNewTip.
|
||||
if (m_chainman.m_options.signals && this == &m_chainman.ActiveChainstate()) {
|
||||
m_chainman.m_options.signals->ActiveTipChange(pindexNewTip, m_chainman.IsInitialBlockDownload());
|
||||
m_chainman.m_options.signals->ActiveTipChange(*Assert(pindexNewTip), m_chainman.IsInitialBlockDownload());
|
||||
}
|
||||
} // release cs_main
|
||||
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
|
||||
|
@ -3778,7 +3778,7 @@ bool Chainstate::InvalidateBlock(BlockValidationState& state, CBlockIndex* pinde
|
|||
// Fire ActiveTipChange now for the current chain tip to make sure clients are notified.
|
||||
// ActivateBestChain may call this as well, but not necessarily.
|
||||
if (m_chainman.m_options.signals) {
|
||||
m_chainman.m_options.signals->ActiveTipChange(m_chain.Tip(), m_chainman.IsInitialBlockDownload());
|
||||
m_chainman.m_options.signals->ActiveTipChange(*Assert(m_chain.Tip()), m_chainman.IsInitialBlockDownload());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -183,9 +183,9 @@ void ValidationSignals::UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlo
|
|||
fInitialDownload);
|
||||
}
|
||||
|
||||
void ValidationSignals::ActiveTipChange(const CBlockIndex *new_tip, bool is_ibd)
|
||||
void ValidationSignals::ActiveTipChange(const CBlockIndex& new_tip, bool is_ibd)
|
||||
{
|
||||
LOG_EVENT("%s: new block hash=%s block height=%d", __func__, new_tip->GetBlockHash().ToString(), new_tip->nHeight);
|
||||
LOG_EVENT("%s: new block hash=%s block height=%d", __func__, new_tip.GetBlockHash().ToString(), new_tip.nHeight);
|
||||
m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.ActiveTipChange(new_tip, is_ibd); });
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ protected:
|
|||
/**
|
||||
* Notifies listeners any time the block chain tip changes, synchronously.
|
||||
*/
|
||||
virtual void ActiveTipChange(const CBlockIndex* new_tip, bool is_ibd) {};
|
||||
virtual void ActiveTipChange(const CBlockIndex& new_tip, bool is_ibd) {};
|
||||
/**
|
||||
* Notifies listeners of a transaction having been added to mempool.
|
||||
*
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
void SyncWithValidationInterfaceQueue() LOCKS_EXCLUDED(cs_main);
|
||||
|
||||
void UpdatedBlockTip(const CBlockIndex *, const CBlockIndex *, bool fInitialDownload);
|
||||
void ActiveTipChange(const CBlockIndex*, bool);
|
||||
void ActiveTipChange(const CBlockIndex&, bool);
|
||||
void TransactionAddedToMempool(const NewMempoolTransactionInfo&, uint64_t mempool_sequence);
|
||||
void TransactionRemovedFromMempool(const CTransactionRef&, MemPoolRemovalReason, uint64_t mempool_sequence);
|
||||
void MempoolTransactionsRemovedForBlock(const std::vector<RemovedMempoolTransactionInfo>&, unsigned int nBlockHeight);
|
||||
|
|
Loading…
Add table
Reference in a new issue