Skip to main content

pack_multiaddrs

Function pack_multiaddrs 

Source
pub fn pack_multiaddrs(addrs: &[String]) -> Result<Vec<u8>>
Expand description

Pack QUIC multiaddr strings into the on-chain multiaddrs bytes field: a sequence of (uint16 length, bytes data) entries with big-endian length prefixes (ADR 019 § Multiaddr encoding). An empty slice yields empty bytes, which the contract accepts (a node may rely on the iroh relay / cdn/dht/v1 discovery for reachability until it promotes direct addresses via updateMultiaddrs).

§Errors

Returns an error if any single multiaddr exceeds u16::MAX bytes (it could not be length-prefixed). The contract separately enforces a total-size ceiling (maxMultiaddrSize, default 1,024 bytes); that bound is reported by the on-chain revert rather than re-checked here.