Struct BoltChannel

Source
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

Source

pub fn stage(&self) -> Lifecycle

Method returning copy of BoltChannel::stage field. Current channel lifecycle stage

Source

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

Source

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.

Source

pub fn local_amount_msat(&self) -> u64

Method returning copy of BoltChannel::local_amount_msat field. Amount in millisatoshis

Source

pub fn remote_amount_msat(&self) -> u64

Method returning copy of BoltChannel::remote_amount_msat field. Amount in millisatoshis

Source

pub fn commitment_number(&self) -> u64

Method returning copy of BoltChannel::commitment_number field.

Source

pub fn commitment_sigs(&self) -> &Vec<Signature>

Method borrowing BoltChannel::commitment_sigs field.

Source

pub fn policy(&self) -> &Policy

Method borrowing BoltChannel::policy field. The policy for accepting remote node params

Source

pub fn common_params(&self) -> CommonParams

Method returning copy of BoltChannel::common_params field. Common parameters applying for both nodes

Source

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

Source

pub fn remote_params(&self) -> PeerParams

Method returning copy of BoltChannel::remote_params field. Channel parameters to be used towards the remote node

Source

pub fn local_keys(&self) -> &LocalKeyset

Method borrowing BoltChannel::local_keys field. Set of locally-derived keys for creating channel transactions

Source

pub fn remote_keys(&self) -> &RemoteKeyset

Method borrowing BoltChannel::remote_keys field. Set of remote-derived keys for creating channel transactions

Source

pub fn remote_per_commitment_point(&self) -> &PublicKey

Source

pub fn local_per_commitment_point(&self) -> &PublicKey

Source

pub fn direction(&self) -> Direction

Method returning copy of BoltChannel::direction field. Keeps information about node directionality

Source§

impl BoltChannel

Source

pub fn channel_id(&self) -> Option<ChannelId>

Returns ChannelId, if the channel already assigned it

Source

pub fn temp_channel_id(&self) -> Option<TempChannelId>

Before the channel is assigned a final ChannelId returns TempChannelId, and None after

Source

pub fn try_channel_id(&self) -> Result<ChannelId, Error>

Returns ChannelId, if the channel already assigned it – or errors otherwise.

Source

pub fn set_temp_channel_id(&mut self, temp_channel_id: TempChannelId)

Assigns channel a temporary id

Source

pub fn set_inbound(&mut self)

Marks the channel as an inbound

Source

pub fn set_outbound(&mut self)

Marks the channel as an outbound

Source

pub fn set_chain_hash(&mut self, chain_hash: Slice32)

Sets the channel chain hash

Source

pub fn set_policy(&mut self, policy: Policy)

Sets channel policy

Source

pub fn set_common_params(&mut self, params: CommonParams)

Sets common parameters for the chanel

Source

pub fn set_local_params(&mut self, params: PeerParams)

Sets local parameters for the channel

Source

pub fn set_local_keys(&mut self, keys: LocalKeyset)

Sets local keys for the channel

Source

pub fn set_static_remotekey(&mut self, static_remotekey: bool)

Sets static_remotekey flag for the channel

Source§

impl BoltChannel

Source

pub fn compose_add_update_htlc( &mut self, amount_msat: u64, payment_hash: HashLock, cltv_expiry: u32, route: Vec<Hop<PaymentOnion>>, ) -> Result<Messages, Error>

Trait Implementations§

Source§

impl ChannelConstructor<BoltExt> for BoltChannel

Source§

fn enrich_funding( &self, psbt: &mut Psbt, funding: &Funding, ) -> Result<(), Error>

Source§

impl ChannelExtension<BoltExt> for BoltChannel

Source§

fn new() -> Box<dyn ChannelExtension<BoltExt>>

Constructs boxed extension objects which can be inserted into channel extension pipeline
Source§

fn build_graph( &self, tx_graph: &mut TxGraph<'_>, as_remote_node: bool, ) -> Result<(), Error>

Applies state to the channel transaction graph
Source§

impl Clone for BoltChannel

Source§

fn clone(&self) -> BoltChannel

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BoltChannel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BoltChannel

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Extension<BoltExt> for BoltChannel

Source§

fn identity(&self) -> BoltExt

Source§

fn update_from_local(&mut self, _message: &()) -> Result<(), Error>

Updates extension state from some local data
Source§

fn update_from_peer(&mut self, message: &Messages) -> Result<(), Error>

Updates extension state from the data taken from the message received from the remote peer
Source§

fn load_state(&mut self, state: &ChannelState)

Source§

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>

Perform a sate change and produce a message which should be communicated to peers notifying them about the state change
Source§

impl PartialEq for BoltChannel

Source§

fn eq(&self, other: &BoltChannel) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StrictDecode for BoltChannel

Source§

fn strict_decode<D: Read>(d: D) -> Result<Self, Error>

Decode with the given 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>

Tries to deserialize byte array into the current type using 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>

Reads data from file at path and reconstructs object from it. Fails with Error::DataNotEntirelyConsumed if file contains remaining data after the object reconstruction.
Source§

impl StrictEncode for BoltChannel

Source§

fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>

Encode with the given 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>

Serializes data as a byte array using StrictEncode::strict_encode function
Source§

fn strict_file_save(&self, path: impl AsRef<Path>) -> Result<usize, Error>

Saves data to a file at a given path. If the file does not exists, attempts to create the file. If the file already exists, it gets truncated.
Source§

impl Eq for BoltChannel

Source§

impl StructuralPartialEq for BoltChannel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> VerifyEq for T
where T: Eq,

Source§

fn verify_eq(&self, other: &T) -> bool

Verifies commit-equivalence of two instances of the same type.