Function breez_sdk_core::bitcoin::blockdata::script::read_uint

pub fn read_uint(data: &[u8], size: usize) -> Result<usize, Error>
Expand description

Read a script-encoded unsigned integer

§Errors

This function returns an error in these cases:

  • data is shorter than size => EarlyEndOfScript
  • size is greater than u16::max_value / 8 (8191) => NumericOverflow
  • The number being read overflows usize => NumericOverflow

Note that this does not return an error for size between core::size_of::<usize>() and u16::max_value / 8 if there’s no overflow.