Module breez_sdk_core::lightning::util::ser
Expand description
A very simple serialization framework which is used to serialize/deserialize messages as well
as ChannelManager
s and ChannelMonitor
s.
Structs§
- Lightning TLV uses a custom variable-length integer called
BigSize
. It is similar to Bitcoin’s variable-length integers except that it is serialized in big-endian instead of little-endian. - Essentially
std::io::Take
but a bit simpler and with a method to walk the underlying stream forward to ensure we always consume exactly the fixed length specified. - Represents a hostname for serialization purposes. Only the character set and length will be validated. The character set consists of ASCII alphanumeric characters, hyphens, and periods. Its length is guaranteed to be representable by a single byte. This serialization is used by
BOLT 7
hostnames. - Writer that only tracks the amount of data written - useful if you need to calculate the length of some data when serialized but don’t yet need the full data.
- A
Read
implementation which tracks whether any bytes have been read at all. This allows us to distinguish between “EOF reached before we started” and “EOF reached mid-read”. - Wrapper to read a required (non-optional) TLV record.
- A wrapper for a
Transaction
which can only be constructed withTransactionU16LenLimited::new
if theTransaction
’s consensus-serialized length is <= u16::MAX. - Wrapper to read a required (non-optional) TLV record that may have been upgraded without backwards compat.
- A type for variable-length values within TLV record where the length is encoded as part of the record. Used to prevent encoding the length twice.
Constants§
- serialization buffer size
Traits§
- A trait that various LDK types implement allowing them to (maybe) be read in from a
Read
. - A trait that various LDK types implement allowing them to be read in from a
Read
. - A trait that various higher-level LDK types implement allowing them to be read in from a
Read
given some additional set of arguments which is required to deserialize. - A trait that various LDK types implement allowing them to be written out to a
Writer
. - A simplified version of
std::io::Write
that exists largely for backwards compatibility. An impl is provided for any type that also implsstd::io::Write
.