Instead clamp it to uint32::max if it exceeds it.
Co-authored-by: Anthony Towns <aj@erisian.com.au>
This is a partial backport of [[https://github.com/bitcoin/bitcoin/pull/30141 | core#30141]]
https://github.com/bitcoin/bitcoin/pull/30141/commits/ab14d1d6a4a8ef5fe5013150e6c5ebcb5f5e4ea9