This refactor doesn't change behaviour, but clarifies that the numbers being dealt with aren't supposed to be negative. This helps when reading the code and allows to remove a sanitizer suppression for the whole file.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/24059 | core#24059]]
Depends on D12813