rpc: Round verificationprogress to exactly 1 for a recent tip

This requires a new lock annotation, but all relevant callers already
held the lock.
This commit is contained in:
MarcoFalke
2025-05-16 13:32:23 +02:00
parent faf6304bdf
commit fa76b378e4
4 changed files with 23 additions and 5 deletions

View File

@@ -326,7 +326,8 @@ public:
}
double getVerificationProgress() override
{
return chainman().GuessVerificationProgress(WITH_LOCK(chainman().GetMutex(), return chainman().ActiveChain().Tip()));
LOCK(chainman().GetMutex());
return chainman().GuessVerificationProgress(chainman().ActiveTip());
}
bool isInitialBlockDownload() override
{
@@ -409,6 +410,7 @@ public:
std::unique_ptr<Handler> handleNotifyBlockTip(NotifyBlockTipFn fn) override
{
return MakeSignalHandler(::uiInterface.NotifyBlockTip_connect([fn, this](SynchronizationState sync_state, const CBlockIndex* block) {
LOCK(chainman().GetMutex());
fn(sync_state, BlockTip{block->nHeight, block->GetBlockTime(), block->GetBlockHash()},
chainman().GuessVerificationProgress(block));
}));