Struct lightning_signer::channel::Channel [−][src]
pub struct Channel {
pub node: Weak<Node>,
pub nonce: Vec<u8>,
pub keys: InMemorySigner,
pub enforcement_state: EnforcementState,
pub setup: ChannelSetup,
pub id0: ChannelId,
pub id: Option<ChannelId>,
pub monitor: ChainMonitor,
// some fields omitted
}
Expand description
After Node::ready_channel
Fields
node: Weak<Node>
A backpointer to the node
nonce: Vec<u8>
The channel nonce, used to derive keys
keys: InMemorySigner
The signer for this channel
enforcement_state: EnforcementState
Channel state for policy enforcement purposes
setup: ChannelSetup
The negotiated channel setup
id0: ChannelId
The initial channel ID
id: Option<ChannelId>
The optional permanent channel ID
monitor: ChainMonitor
The chain monitor
Implementations
pub fn set_next_counterparty_commit_num_for_testing(
&mut self,
num: u64,
current_point: PublicKey
)
pub fn sign_counterparty_commitment_tx_phase2(
&mut self,
remote_per_commitment_point: &PublicKey,
commitment_number: u64,
feerate_per_kw: u32,
to_holder_value_sat: u64,
to_counterparty_value_sat: u64,
offered_htlcs: Vec<HTLCInfo2>,
received_htlcs: Vec<HTLCInfo2>
) -> Result<(Vec<u8>, Vec<Vec<u8>>), Status>
pub fn sign_counterparty_commitment_tx_phase2(
&mut self,
remote_per_commitment_point: &PublicKey,
commitment_number: u64,
feerate_per_kw: u32,
to_holder_value_sat: u64,
to_counterparty_value_sat: u64,
offered_htlcs: Vec<HTLCInfo2>,
received_htlcs: Vec<HTLCInfo2>
) -> Result<(Vec<u8>, Vec<Vec<u8>>), Status>
Sign a counterparty commitment transaction after rebuilding it from the supplied arguments.
pub fn validate_holder_commitment_tx_phase2(
&mut self,
commitment_number: u64,
feerate_per_kw: u32,
to_holder_value_sat: u64,
to_counterparty_value_sat: u64,
offered_htlcs: Vec<HTLCInfo2>,
received_htlcs: Vec<HTLCInfo2>,
counterparty_commit_sig: &Signature,
counterparty_htlc_sigs: &Vec<Signature>
) -> Result<(PublicKey, Option<SecretKey>), Status>
pub fn validate_holder_commitment_tx_phase2(
&mut self,
commitment_number: u64,
feerate_per_kw: u32,
to_holder_value_sat: u64,
to_counterparty_value_sat: u64,
offered_htlcs: Vec<HTLCInfo2>,
received_htlcs: Vec<HTLCInfo2>,
counterparty_commit_sig: &Signature,
counterparty_htlc_sigs: &Vec<Signature>
) -> Result<(PublicKey, Option<SecretKey>), Status>
Validate the counterparty’s signatures on the holder’s commitment and HTLCs when the commitment_signed message is received. Returns the next per_commitment_point and the holder’s revocation secret for the prior commitment. This method advances the expected next holder commitment number in the signer’s state.
Sign a holder commitment when force-closing
Sign a holder commitment transaction after rebuilding it from the supplied arguments.
Build channel parameters, used to further build a commitment transaction
Get the shutdown script where our funds will go when we mutual-close
Sign a mutual close transaction after rebuilding it from the supplied arguments
Sign a delayed output that goes to us while sweeping a transaction we broadcast
pub fn sign_counterparty_htlc_sweep(
&self,
tx: &Transaction,
input: usize,
remote_per_commitment_point: &PublicKey,
redeemscript: &Script,
htlc_amount_sat: u64,
wallet_path: &Vec<u32>
) -> Result<Signature, Status>
pub fn sign_counterparty_htlc_sweep(
&self,
tx: &Transaction,
input: usize,
remote_per_commitment_point: &PublicKey,
redeemscript: &Script,
htlc_amount_sat: u64,
wallet_path: &Vec<u32>
) -> Result<Signature, Status>
Sign an offered or received HTLC output from a commitment the counterparty broadcast.
pub fn sign_justice_sweep(
&self,
tx: &Transaction,
input: usize,
revocation_secret: &SecretKey,
redeemscript: &Script,
amount_sat: u64,
wallet_path: &Vec<u32>
) -> Result<Signature, Status>
pub fn sign_justice_sweep(
&self,
tx: &Transaction,
input: usize,
revocation_secret: &SecretKey,
redeemscript: &Script,
amount_sat: u64,
wallet_path: &Vec<u32>
) -> Result<Signature, Status>
Sign a justice transaction on an old state that the counterparty broadcast
Sign a channel announcement with both the node key and the funding key
The node has signed our funding transaction
Phase 1
pub fn validate_holder_commitment_tx(
&mut self,
tx: &Transaction,
output_witscripts: &Vec<Vec<u8>>,
commitment_number: u64,
feerate_per_kw: u32,
offered_htlcs: Vec<HTLCInfo2>,
received_htlcs: Vec<HTLCInfo2>,
counterparty_commit_sig: &Signature,
counterparty_htlc_sigs: &Vec<Signature>
) -> Result<(PublicKey, Option<SecretKey>), Status>
pub fn validate_holder_commitment_tx(
&mut self,
tx: &Transaction,
output_witscripts: &Vec<Vec<u8>>,
commitment_number: u64,
feerate_per_kw: u32,
offered_htlcs: Vec<HTLCInfo2>,
received_htlcs: Vec<HTLCInfo2>,
counterparty_commit_sig: &Signature,
counterparty_htlc_sigs: &Vec<Signature>
) -> Result<(PublicKey, Option<SecretKey>), Status>
Validate the counterparty’s signatures on the holder’s commitment and HTLCs when the commitment_signed message is received. Returns the next per_commitment_point and the holder’s revocation secret for the prior commitment. This method advances the expected next holder commitment number in the signer’s state.
Process the counterparty’s revocation
When this is provided, we know that the counterparty has committed to the next state.
pub fn sign_mutual_close_tx(
&mut self,
tx: &Transaction,
opaths: &Vec<Vec<u32>>
) -> Result<Signature, Status>
pub fn sign_mutual_close_tx(
&mut self,
tx: &Transaction,
opaths: &Vec<Vec<u32>>
) -> Result<Signature, Status>
Phase 1
pub fn sign_holder_htlc_tx(
&self,
tx: &Transaction,
commitment_number: u64,
opt_per_commitment_point: Option<PublicKey>,
redeemscript: &Script,
htlc_amount_sat: u64,
output_witscript: &Script
) -> Result<TypedSignature, Status>
pub fn sign_holder_htlc_tx(
&self,
tx: &Transaction,
commitment_number: u64,
opt_per_commitment_point: Option<PublicKey>,
redeemscript: &Script,
htlc_amount_sat: u64,
output_witscript: &Script
) -> Result<TypedSignature, Status>
Phase 1
pub fn sign_counterparty_htlc_tx(
&self,
tx: &Transaction,
remote_per_commitment_point: &PublicKey,
redeemscript: &Script,
htlc_amount_sat: u64,
output_witscript: &Script
) -> Result<TypedSignature, Status>
pub fn sign_counterparty_htlc_tx(
&self,
tx: &Transaction,
remote_per_commitment_point: &PublicKey,
redeemscript: &Script,
htlc_amount_sat: u64,
output_witscript: &Script
) -> Result<TypedSignature, Status>
Phase 1
pub fn sign_htlc_tx(
&self,
tx: &Transaction,
per_commitment_point: &PublicKey,
redeemscript: &Script,
htlc_amount_sat: u64,
output_witscript: &Script,
is_counterparty: bool,
txkeys: TxCreationKeys
) -> Result<TypedSignature, Status>
pub fn sign_htlc_tx(
&self,
tx: &Transaction,
per_commitment_point: &PublicKey,
redeemscript: &Script,
htlc_amount_sat: u64,
output_witscript: &Script,
is_counterparty: bool,
txkeys: TxCreationKeys
) -> Result<TypedSignature, Status>
Sign a 2nd level HTLC transaction hanging off a commitment transaction
pub fn get_unilateral_close_key(
&self,
commitment_point: &Option<PublicKey>
) -> Result<SecretKey, Status>
pub fn get_unilateral_close_key(
&self,
commitment_point: &Option<PublicKey>
) -> Result<SecretKey, Status>
Get the unilateral close key, for sweeping the to-remote output of a counterparty’s force-close
Trait Implementations
Get the channel basepoints and public keys
Get the per-commitment point for a holder commitment transaction
Get the per-commitment secret for a holder commitment transaction
Check a future secret to support option_data_loss_protect
Get the channel nonce, used to derive the channel keys
fn validator(&self) -> Box<dyn Validator>ⓘimpl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn validator(&self) -> Box<dyn Validator>ⓘimpl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
Returns the validator for this channel
Auto Trait Implementations
impl !RefUnwindSafe for Channel
impl !UnwindSafe for Channel
Blanket Implementations
Mutably borrows from an owned value. Read more