tests: Add amount compression/decompression fuzzing to existing fuzzing harness
Summary:
Small fuzzing improvement: Add amount compression/decompression fuzzing to existing fuzzing harness: test compression round-trip (DecompressAmount(CompressAmount(…))). Make the domain of CompressAmount(…) explicit.
Backport of core PR17917.
This is actually adapted to fix an existing fuzzing issue: the
CompressAmount() function expects the amount to be positive, while our
Amount operator works on signed integer. As a consequence the case
where the amount is negative is skipped to match the CompressAmount()
precondition.
Test Plan:
ninja bitcoin-fuzzers ./src/test/fuzz/integer <path_to_corpus>
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Differential Revision: https://reviews.bitcoinabc.org/D8958