Review report

core: PR #36690

1 suggestion

Optional improvements

Link

[suggestion] · The three-error test does not verify the reported two-character correction

Checking only the number of positions does not show that changing those positions can produce a valid string or establish its encoding.

Location: src/test/bech32_tests.cpp:238 (head).

Details and suggested fix

The fixture changes positions 3, 500, and 1022 of valid_1023, then checks only that LocateErrors returns two positions. It does not verify the comment's claim that two character changes can fix the string. Try all 32 charset characters at each returned position and assert that at least one replacement decodes, including the resulting encoding. LocateErrors returns positions without replacement values. If the existing expectation of Invalid Bech32 checksum holds, the two-character alternative uses a Bech32 checksum, not Bech32m, and DecodeSilentPaymentsAddress would reject it. Checking the encoding documents what the alternative actually is.


Coverage details