pub fn to_u32(value: i64, field: &str) -> Result<u32, NumericError>Expand description
Converts an i64 numeric type to a u32.
The Bitcoin Core JSONRPC API has fields marked as ‘numeric’. It is not obvious what Rust type these fields should be.
We want the version specific JSON types to just work (TM).
- We use an
i64because its the biggest signed integer on “common” machines. - We use a signed integer because Core sometimes returns -1.
(2) was discovered in the wild but is hard to test for.