bc

Type Alias VarIntArray

Source
pub type VarIntArray<T, const MIN_LEN: usize = 0> = Confined<Vec<T>, MIN_LEN, U32>;
Expand description

Bitcoin consensus allows arrays which length is encoded as VarInt to grow up to 64-bit values. However, at the same time no consensus rule allows any block data structure to exceed 2^32 bytes (4GB), and any change to that rule will be a hardfork. So for practical reasons we are safe to restrict the maximum size here with just 32 bits.

Aliased Type§

struct VarIntArray<T, const MIN_LEN: usize = 0>(/* private fields */);

Trait Implementations§

Source§

impl<T: ConsensusDecode, const MIN_LEN: usize> ConsensusDecode for VarIntArray<T, MIN_LEN>

Source§

impl<T: ConsensusEncode, const MIN_LEN: usize> ConsensusEncode for VarIntArray<T, MIN_LEN>

Source§

fn consensus_encode(&self, writer: &mut impl Write) -> Result<usize, IoError>

Source§

fn consensus_serialize(&self) -> Vec<u8>

Source§

impl From<Witness> for VarIntArray<ByteStr>

Source§

fn from(wrapped: Witness) -> Self

Converts to this type from the input type.
Source§

impl<T, const MIN_LEN: usize> LenVarInt for VarIntArray<T, MIN_LEN>