pub struct BoltChannel { /* private fields */ }
Expand description
The core of the lightning channel operating according to the Bolt3 standard.
This is “channel constructor” used by Channel
structure and managing part
of the state which is not HTLC-related.
The type should not be constructed directly or used from outside of the library, but it’s made public for allowing channel state access.
Implementations§
Source§impl BoltChannel
impl BoltChannel
Sourcepub fn stage(&self) -> Lifecycle
pub fn stage(&self) -> Lifecycle
Method returning copy of BoltChannel::stage
field.
Current channel lifecycle stage
Sourcepub fn chain_hash(&self) -> Slice32
pub fn chain_hash(&self) -> Slice32
Method returning copy of BoltChannel::chain_hash
field.
The chain_hash value denotes the exact blockchain that the opened
Sourcepub fn active_channel_id(&self) -> ActiveChannelId
pub fn active_channel_id(&self) -> ActiveChannelId
Method returning copy of BoltChannel::active_channel_id
field.
Channel id used by the channel; first temporary and later final.
Sourcepub fn local_amount_msat(&self) -> u64
pub fn local_amount_msat(&self) -> u64
Method returning copy of BoltChannel::local_amount_msat
field.
Amount in millisatoshis
Sourcepub fn remote_amount_msat(&self) -> u64
pub fn remote_amount_msat(&self) -> u64
Method returning copy of BoltChannel::remote_amount_msat
field.
Amount in millisatoshis
Sourcepub fn commitment_number(&self) -> u64
pub fn commitment_number(&self) -> u64
Method returning copy of BoltChannel::commitment_number
field.
Sourcepub fn commitment_sigs(&self) -> &Vec<Signature>
pub fn commitment_sigs(&self) -> &Vec<Signature>
Method borrowing BoltChannel::commitment_sigs
field.
Sourcepub fn policy(&self) -> &Policy
pub fn policy(&self) -> &Policy
Method borrowing BoltChannel::policy
field.
The policy for accepting remote node params
Sourcepub fn common_params(&self) -> CommonParams
pub fn common_params(&self) -> CommonParams
Method returning copy of BoltChannel::common_params
field.
Common parameters applying for both nodes
Sourcepub fn local_params(&self) -> PeerParams
pub fn local_params(&self) -> PeerParams
Method returning copy of BoltChannel::local_params
field.
Channel parameters required to be met by the remote node when operating
Sourcepub fn remote_params(&self) -> PeerParams
pub fn remote_params(&self) -> PeerParams
Method returning copy of BoltChannel::remote_params
field.
Channel parameters to be used towards the remote node
Sourcepub fn local_keys(&self) -> &LocalKeyset
pub fn local_keys(&self) -> &LocalKeyset
Method borrowing BoltChannel::local_keys
field.
Set of locally-derived keys for creating channel transactions
Sourcepub fn remote_keys(&self) -> &RemoteKeyset
pub fn remote_keys(&self) -> &RemoteKeyset
Method borrowing BoltChannel::remote_keys
field.
Set of remote-derived keys for creating channel transactions
Sourcepub fn remote_per_commitment_point(&self) -> &PublicKey
pub fn remote_per_commitment_point(&self) -> &PublicKey
Method borrowing BoltChannel::remote_per_commitment_point
field.
Sourcepub fn local_per_commitment_point(&self) -> &PublicKey
pub fn local_per_commitment_point(&self) -> &PublicKey
Method borrowing BoltChannel::local_per_commitment_point
field.
Sourcepub fn direction(&self) -> Direction
pub fn direction(&self) -> Direction
Method returning copy of BoltChannel::direction
field.
Keeps information about node directionality
Source§impl BoltChannel
impl BoltChannel
Sourcepub fn channel_id(&self) -> Option<ChannelId>
pub fn channel_id(&self) -> Option<ChannelId>
Returns ChannelId
, if the channel already assigned it
Sourcepub fn temp_channel_id(&self) -> Option<TempChannelId>
pub fn temp_channel_id(&self) -> Option<TempChannelId>
Before the channel is assigned a final ChannelId
returns
TempChannelId
, and None
after
Sourcepub fn try_channel_id(&self) -> Result<ChannelId, Error>
pub fn try_channel_id(&self) -> Result<ChannelId, Error>
Returns ChannelId
, if the channel already assigned it – or errors
otherwise.
Sourcepub fn set_temp_channel_id(&mut self, temp_channel_id: TempChannelId)
pub fn set_temp_channel_id(&mut self, temp_channel_id: TempChannelId)
Assigns channel a temporary id
Sourcepub fn set_inbound(&mut self)
pub fn set_inbound(&mut self)
Marks the channel as an inbound
Sourcepub fn set_outbound(&mut self)
pub fn set_outbound(&mut self)
Marks the channel as an outbound
Sourcepub fn set_chain_hash(&mut self, chain_hash: Slice32)
pub fn set_chain_hash(&mut self, chain_hash: Slice32)
Sets the channel chain hash
Sourcepub fn set_policy(&mut self, policy: Policy)
pub fn set_policy(&mut self, policy: Policy)
Sets channel policy
Sourcepub fn set_common_params(&mut self, params: CommonParams)
pub fn set_common_params(&mut self, params: CommonParams)
Sets common parameters for the chanel
Sourcepub fn set_local_params(&mut self, params: PeerParams)
pub fn set_local_params(&mut self, params: PeerParams)
Sets local parameters for the channel
Sourcepub fn set_local_keys(&mut self, keys: LocalKeyset)
pub fn set_local_keys(&mut self, keys: LocalKeyset)
Sets local keys for the channel
Sourcepub fn set_static_remotekey(&mut self, static_remotekey: bool)
pub fn set_static_remotekey(&mut self, static_remotekey: bool)
Sets static_remotekey
flag for the channel
Source§impl BoltChannel
impl BoltChannel
Trait Implementations§
Source§impl ChannelConstructor<BoltExt> for BoltChannel
impl ChannelConstructor<BoltExt> for BoltChannel
Source§impl ChannelExtension<BoltExt> for BoltChannel
impl ChannelExtension<BoltExt> for BoltChannel
Source§impl Clone for BoltChannel
impl Clone for BoltChannel
Source§fn clone(&self) -> BoltChannel
fn clone(&self) -> BoltChannel
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BoltChannel
impl Debug for BoltChannel
Source§impl Default for BoltChannel
impl Default for BoltChannel
Source§impl Extension<BoltExt> for BoltChannel
impl Extension<BoltExt> for BoltChannel
fn identity(&self) -> BoltExt
Source§fn update_from_local(&mut self, _message: &()) -> Result<(), Error>
fn update_from_local(&mut self, _message: &()) -> Result<(), Error>
Source§fn update_from_peer(&mut self, message: &Messages) -> Result<(), Error>
fn update_from_peer(&mut self, message: &Messages) -> Result<(), Error>
fn load_state(&mut self, state: &ChannelState)
fn store_state(&self, state: &mut ChannelState)
Source§fn state_change(
&mut self,
request: &<N as Nomenclature>::UpdateRequest,
message: &mut <N as Nomenclature>::PeerMessage,
) -> Result<(), <N as Nomenclature>::Error>
fn state_change( &mut self, request: &<N as Nomenclature>::UpdateRequest, message: &mut <N as Nomenclature>::PeerMessage, ) -> Result<(), <N as Nomenclature>::Error>
Source§impl PartialEq for BoltChannel
impl PartialEq for BoltChannel
Source§impl StrictDecode for BoltChannel
impl StrictDecode for BoltChannel
Source§fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
std::io::Read
instance; must either
construct an instance or return implementation-specific error type.Source§fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
StrictDecode::strict_decode
. If there are some data remains in the
buffer once deserialization is completed, fails with
Error::DataNotEntirelyConsumed
. Use io::Cursor
over the buffer and
StrictDecode::strict_decode
to avoid such failures.Source§fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
path
and reconstructs object from it. Fails
with Error::DataNotEntirelyConsumed
if file contains remaining
data after the object reconstruction.Source§impl StrictEncode for BoltChannel
impl StrictEncode for BoltChannel
Source§fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type.Source§fn strict_serialize(&self) -> Result<Vec<u8>, Error>
fn strict_serialize(&self) -> Result<Vec<u8>, Error>
StrictEncode::strict_encode
functionimpl Eq for BoltChannel
impl StructuralPartialEq for BoltChannel
Auto Trait Implementations§
impl Freeze for BoltChannel
impl RefUnwindSafe for BoltChannel
impl Send for BoltChannel
impl Sync for BoltChannel
impl Unpin for BoltChannel
impl UnwindSafe for BoltChannel
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<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.