Struct ChannelId
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§
§impl ChannelId
impl ChannelId
pub fn v1_from_funding_txid(txid: &[u8; 32], output_index: u16) -> ChannelId
pub fn v1_from_funding_txid(txid: &[u8; 32], output_index: u16) -> ChannelId
Create v1 channel ID based on a funding TX ID and output index
pub fn v1_from_funding_outpoint(outpoint: OutPoint) -> ChannelId
pub fn v1_from_funding_outpoint(outpoint: OutPoint) -> ChannelId
Create v1 channel ID from a funding tx outpoint
pub fn temporary_from_entropy_source<ES>(entropy_source: &ES) -> ChannelId
pub fn temporary_from_entropy_source<ES>(entropy_source: &ES) -> ChannelId
Create a temporary channel ID randomly, based on an entropy source.
pub fn from_bytes(data: [u8; 32]) -> ChannelId
pub fn from_bytes(data: [u8; 32]) -> ChannelId
Generic constructor; create a new channel ID from the provided data.
Use a more specific *_from_*
constructor when possible.
pub fn new_zero() -> ChannelId
pub fn new_zero() -> ChannelId
Create a channel ID consisting of all-zeros data (e.g. when uninitialized or a placeholder).
pub fn v2_from_revocation_basepoints(
ours: &RevocationBasepoint,
theirs: &RevocationBasepoint,
) -> ChannelId
pub fn v2_from_revocation_basepoints( ours: &RevocationBasepoint, theirs: &RevocationBasepoint, ) -> ChannelId
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.
pub fn temporary_v2_from_revocation_basepoint(
our_revocation_basepoint: &RevocationBasepoint,
) -> ChannelId
pub fn temporary_v2_from_revocation_basepoint( our_revocation_basepoint: &RevocationBasepoint, ) -> ChannelId
Create temporary v2 channel ID by concatenating a zeroed out basepoint with the holder revocation basepoint and hashing the result.
Trait Implementations§
§impl Ord for ChannelId
impl Ord for ChannelId
§impl PartialOrd for ChannelId
impl PartialOrd for ChannelId
§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§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any
.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> MaybeReadable for Twhere
T: Readable,
impl<T> MaybeReadable for Twhere
T: Readable,
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.