refactor: Pass verification_progress into block tip notifications

It is cheap to calculate and the caller does not have to take a lock to
calculate it.

Also turn pointers that can never be null into references.
This commit is contained in:
MarcoFalke
2025-05-20 10:46:59 +02:00
parent fa76b378e4
commit fab1e02086
9 changed files with 25 additions and 17 deletions

View File

@@ -48,7 +48,7 @@ static void AlertNotify(const std::string& strMessage)
namespace node {
kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state, CBlockIndex& index)
kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state, CBlockIndex& index, double verification_progress)
{
{
LOCK(m_tip_block_mutex);
@@ -57,7 +57,7 @@ kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state
m_tip_block_cv.notify_all();
}
uiInterface.NotifyBlockTip(state, &index);
uiInterface.NotifyBlockTip(state, index, verification_progress);
if (m_stop_at_height && index.nHeight >= m_stop_at_height) {
if (!m_shutdown_request()) {
LogError("Failed to send shutdown signal after reaching stop height\n");