Skip to content

Commit

Permalink
fixup! Check and return commit tx number
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibo-lg committed Oct 4, 2023
1 parent 78cbe21 commit b13daab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ pub use crate::ln::outbound_payment::{PaymentSendFailure, Retry, RetryableSendFa
use crate::ln::script::ShutdownScript;
use super::msgs::{CommitmentSigned, RevokeAndACK};

pub type NumberedCommitmentSigned = (CommitmentSigned, u64);

// We hold various information about HTLC relay in the HTLC objects in Channel itself:
//
// Upon receipt of an HTLC from a peer, we'll give it a PendingHTLCStatus indicating if it should
Expand Down Expand Up @@ -2703,22 +2705,24 @@ where
self.close_channel_internal(channel_id, counterparty_node_id, target_feerate_sats_per_1000_weight, shutdown_script)
}

///
pub fn get_updated_funding_outpoint_commitment_signed(&self, channel_lock: &mut ChannelLock<<SP::Target as SignerProvider>::Signer>, funding_outpoint: &OutPoint, channel_value_satoshis: u64, value_to_self_msat: u64) -> Result<(CommitmentSigned, u64), APIError> {
/// Updates the funding output and returns the `CommitmentSigned` message for the updated
/// commitment transaction, as well as the commitment transaction number.
pub fn get_updated_funding_outpoint_commitment_signed(&self, channel_lock: &mut ChannelLock<<SP::Target as SignerProvider>::Signer>, funding_outpoint: &OutPoint, channel_value_satoshis: u64, value_to_self_msat: u64) -> Result<NumberedCommitmentSigned, APIError> {
self.get_updated_funding_outpoint_commitment_signed_internal(channel_lock, funding_outpoint, channel_value_satoshis, value_to_self_msat)
}

///
/// Process and validates the given commitment signature and returns the RAA to be given to the
/// counterparty on success.
pub fn on_commitment_signed_get_raa(&self, channel_lock: &mut ChannelLock<<SP::Target as SignerProvider>::Signer>, commitment_signature: &secp256k1::ecdsa::Signature, htlc_signatures: &[secp256k1::ecdsa::Signature]) -> Result<RevokeAndACK, APIError> {
self.on_commitment_signed_get_raa_internal(channel_lock, commitment_signature, htlc_signatures)
}

///
/// Process the given RAA message.
pub fn revoke_and_ack_commitment(&self, channel_lock: &mut ChannelLock<<SP::Target as SignerProvider>::Signer>, revoke_and_ack: &RevokeAndACK) -> Result<(), APIError> {
self.revoke_and_ack_commitment_internal(channel_lock, revoke_and_ack)
}

///
/// Set the funding outpoint for the channel to the given values.
pub fn set_funding_outpoint(&self, channel_lock: &mut ChannelLock<<SP::Target as SignerProvider>::Signer>, funding_output: &OutPoint, channel_value_satoshis: u64, value_to_self_msat: u64) {
self.set_funding_outpoint_internal(channel_lock, funding_output, channel_value_satoshis, value_to_self_msat);
}
Expand Down

0 comments on commit b13daab

Please sign in to comment.