HomePhabricator

wallet: fix scanning progress calculation for single block range

Description

wallet: fix scanning progress calculation for single block range

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

Reviewers: #bitcoin_abc, deadalnix, Fabien

Reviewed By: #bitcoin_abc, deadalnix, Fabien

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D10193

Details

Provenance
Sebastian Falbesoner <sebastian.falbesoner@gmail.com>Authored on Nov 8 2020, 17:37
PiRKCommitted on Sep 28 2021, 07:33
PiRKPushed on Sep 28 2021, 07:33
Reviewer
Restricted Project
Differential Revision
D10193: wallet: fix scanning progress calculation for single block range
Parents
rABC68b6c641f45d: Recommend port 15353 when running in user space
Branches
Unknown
Tags
Unknown