pub struct ChannelId(/* private fields */);
Expand description
Channel identifier
This id is used to coordinate with the node and is not related to the channel ids in the Lightning protocol. The channel keys are derived from this and a base key.
A channel may have more than one id.
There are currently two ways to generate ids: one which uses
a peer id and is compatible with CLN, and one which doesn’t
and is compatible with LDK. In both cases the id of the channel
at the node (called a dbid
in CLN or oid in LDK) is stored in little-endian in the final 8 bytes of the id. This fact is relied when retrieving the
dbid/
oid`.
Implementations§
Source§impl ChannelId
impl ChannelId
Sourcepub fn new_from_oid(oid: u64) -> Self
pub fn new_from_oid(oid: u64) -> Self
Create an id from an oid (LDK-style)
The nonce is a 32 byte array, where the first 24 bytes are 0 and the last 8 are the original id (little-endian)
Sourcepub fn new_from_peer_id_and_oid(peer_id: &[u8; 33], oid: u64) -> Self
pub fn new_from_peer_id_and_oid(peer_id: &[u8; 33], oid: u64) -> Self
Create an id from a peer id and oid (CLN-style)
The nonce is a 41 byte array, where the first 33 bytes are the peer id and the final 8 are the original id (little-endian)
Sourcepub fn ldk_channel_keys_id(&self) -> [u8; 32]
pub fn ldk_channel_keys_id(&self) -> [u8; 32]
Return the id in a format compatible with the LDK
SignerProvider
generate_channel_keys_id
interface
This will panic if the nonce is not exactly 32 bytes