Continuation of #30569.
Since https://github.com/bitcoin/bitcoin/commit/fad2991ba073de0bd1f12e42bf0fbaca4a265508, uint256S()
has been deprecated because it is less robust than the base_blob::FromHex()
introduced in #30482. Specifically, it tries to recover from length-mismatches, recover from untrimmed whitespace, 0x-prefix and garbage at the end, instead of simply requiring exactly 64 hex-only characters. (see also #30532)
This PR removes uint256S()
(and uint160S()
) completely, with no non-test behaviour change.
Specifically, the main changes in this PR are:
- the (minimal) last non-test usage of
uint256S()
inParseHashV()
is removed without behaviour change, which can partially be verified by cherry-picking and/or modifying this test commit). - the test usage of
uint{160,256}S()
is removed, largely replacing it withuint{160,256}::FromHex()
where applicable, potentially modifying the test by removing non-hex characters or dropping the test entirely if removing non-hex characters makes it redundant - the now unused
uint{160,256}S()
functions are removed completely. - unit test coverage on converting
uint256
<->arith_uint256
throughUintToArith256()
andArithToUint256()
is beefed up, andarith_uint256
tests are moved toarith_uint256_tests.cpp
, removing theuint256_tests.cpp
dependency onuint256h
, mirroring how the code is structured.
Note: uint256::FromUserHex()
exists to more leniently construct uint256 from user input, allowing “0x” prefixes and too-short-input, as safer alternative to uint256S()
where necessary.