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.
This is not exported to bindings users as we just use [u8; 32] directly.
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.
Trait Implementations§
source§impl Ord for ChannelId
impl Ord for ChannelId
source§impl PartialEq for ChannelId
impl PartialEq for ChannelId
source§impl PartialOrd for ChannelId
impl PartialOrd for ChannelId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more