Page MenuHomePhabricator

wallet: fix scanning progress calculation for single block range
ClosedPublic

Authored by PiRK on Sep 24 2021, 08:51.

Details

Summary

If the blockchain is rescanned for a single block (i.e. start and stop hashes
are equal, and with that also the estimated verification progress) the progress
calculation could lead to a NaN value caused by a division by zero, resulting in
an invalid JSON result for the getwalletinfo RPC. Fixed by setting the progress
to zero in that special case.

Co-authored-by: MarcoFalke <falke.marco@gmail.com>

This is a backport of core#20344

Test Plan

With UBSAN:
ninja && ninja check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Sep 24 2021, 08:51
deadalnix requested changes to this revision.Sep 24 2021, 19:55
deadalnix added a subscriber: deadalnix.

The PR clearly doesn't match.

This revision now requires changes to proceed.Sep 24 2021, 19:55
PiRK requested review of this revision.Sep 24 2021, 20:04
PiRK edited the summary of this revision. (Show Details)

Sorry. I fixed it in the summary.

This revision is now accepted and ready to land.Sep 27 2021, 21:58