Skip to content

Commit

Permalink
f - add docs on panic + add more info on expect in channel reestablish
Browse files Browse the repository at this point in the history
  • Loading branch information
alecchendev committed Jul 10, 2024
1 parent 3f142b3 commit d9a371f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5629,7 +5629,9 @@ impl<SP: Deref> Channel<SP> where

let our_commitment_transaction = INITIAL_COMMITMENT_NUMBER - self.context.holder_commitment_point.transaction_number() - 1;
if msg.next_remote_commitment_number > 0 {
let expected_point = self.context.holder_signer.as_ref().get_per_commitment_point(INITIAL_COMMITMENT_NUMBER - msg.next_remote_commitment_number + 1, &self.context.secp_ctx).expect("TODO");
let expected_point = self.context.holder_signer.as_ref()
.get_per_commitment_point(INITIAL_COMMITMENT_NUMBER - msg.next_remote_commitment_number + 1, &self.context.secp_ctx)
.expect("TODO: async signing is not yet supported for per commitment points upon channel reestablishment");
let given_secret = SecretKey::from_slice(&msg.your_last_per_commitment_secret)
.map_err(|_| ChannelError::close("Peer sent a garbage channel_reestablish with unparseable secret key".to_owned()))?;
if expected_point != PublicKey::from_secret_key(&self.context.secp_ctx, &given_secret) {
Expand Down
4 changes: 4 additions & 0 deletions lightning/src/sign/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,10 @@ impl HTLCDescriptor {

/// A trait to handle Lightning channel key material without concretizing the channel type or
/// the signature mechanism.
///
/// Several methods allow error types to be returned to support async signing. This feature
/// is not yet complete, and panics may occur in certain situations when returning errors
/// for these methods.
pub trait ChannelSigner {
/// Gets the per-commitment point for a specific commitment number
///
Expand Down

0 comments on commit d9a371f

Please sign in to comment.