pub struct ChannelId(pub [u8; 32]);Expand description
A unique 32-byte identifier for a channel. Depending on how the ID is generated, several varieties are distinguished (but all are stored as 32 bytes): v1 and temporary. A v1 channel ID is generated based on funding tx outpoint (txid & index). A temporary ID is generated randomly. (Later revocation-point-based v2 is a possibility.) The variety (context) is not stored, it is relevant only at creation.
Tuple Fields§
§0: [u8; 32]Implementations§
Source§impl ChannelId
impl ChannelId
Sourcepub fn v1_from_funding_txid(txid: &[u8; 32], output_index: u16) -> Self
pub fn v1_from_funding_txid(txid: &[u8; 32], output_index: u16) -> Self
Create v1 channel ID based on a funding TX ID and output index
Sourcepub fn v1_from_funding_outpoint(outpoint: OutPoint) -> Self
pub fn v1_from_funding_outpoint(outpoint: OutPoint) -> Self
Create v1 channel ID from a funding tx outpoint
Sourcepub fn temporary_from_entropy_source<ES: Deref>(entropy_source: &ES) -> Selfwhere
ES::Target: EntropySource,
pub fn temporary_from_entropy_source<ES: Deref>(entropy_source: &ES) -> Selfwhere
ES::Target: EntropySource,
Create a temporary channel ID randomly, based on an entropy source.
Sourcepub fn from_bytes(data: [u8; 32]) -> Self
pub fn from_bytes(data: [u8; 32]) -> Self
Generic constructor; create a new channel ID from the provided data.
Use a more specific *_from_* constructor when possible.
Sourcepub fn new_zero() -> Self
pub fn new_zero() -> Self
Create a channel ID consisting of all-zeros data (e.g. when uninitialized or a placeholder).
Sourcepub fn v2_from_revocation_basepoints(
ours: &RevocationBasepoint,
theirs: &RevocationBasepoint,
) -> Self
pub fn v2_from_revocation_basepoints( ours: &RevocationBasepoint, theirs: &RevocationBasepoint, ) -> Self
Create v2 channel ID by concatenating the holder revocation basepoint with the counterparty revocation basepoint and hashing the result. The basepoints will be concatenated in increasing sorted order.
Sourcepub fn temporary_v2_from_revocation_basepoint(
our_revocation_basepoint: &RevocationBasepoint,
) -> Self
pub fn temporary_v2_from_revocation_basepoint( our_revocation_basepoint: &RevocationBasepoint, ) -> Self
Create temporary v2 channel ID by concatenating a zeroed out basepoint with the holder revocation basepoint and hashing the result.
Sourcepub fn is_v2_channel_id(
&self,
ours: &RevocationBasepoint,
theirs: &RevocationBasepoint,
) -> bool
pub fn is_v2_channel_id( &self, ours: &RevocationBasepoint, theirs: &RevocationBasepoint, ) -> bool
Indicates whether this is a V2 channel ID for the given local and remote revocation basepoints.
Trait Implementations§
Source§impl Ord for ChannelId
impl Ord for ChannelId
Source§impl PartialOrd for ChannelId
impl PartialOrd for ChannelId
Source§impl Writeable for ChannelId
impl Writeable for ChannelId
impl Copy for ChannelId
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> LengthReadable for Twhere
T: Readable,
impl<T> LengthReadable for Twhere
T: Readable,
Source§fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
Self in from the given LengthLimitedRead.