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
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ChannelId
impl<'de> Deserialize<'de> for ChannelId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'de> DeserializeAs<'de, ChannelId> for ChannelIdHandler
impl<'de> DeserializeAs<'de, ChannelId> for ChannelIdHandler
Source§fn deserialize_as<D>(deserializer: D) -> Result<ChannelId, D::Error>where
D: Deserializer<'de>,
fn deserialize_as<D>(deserializer: D) -> Result<ChannelId, D::Error>where
D: Deserializer<'de>,
Source§impl Ord for ChannelId
impl Ord for ChannelId
Source§impl PartialOrd for ChannelId
impl PartialOrd for ChannelId
Source§impl SerializeAs<ChannelId> for ChannelIdHandler
impl SerializeAs<ChannelId> for ChannelIdHandler
Source§fn serialize_as<S>(source: &ChannelId, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
fn serialize_as<S>(source: &ChannelId, serializer: S) -> Result<S::Ok, S::Error>where
S: Serializer,
impl Eq for ChannelId
impl StructuralPartialEq for ChannelId
Auto Trait Implementations§
impl Freeze for ChannelId
impl RefUnwindSafe for ChannelId
impl Send for ChannelId
impl Sync for ChannelId
impl Unpin for ChannelId
impl UnwindSafe for ChannelId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more