Skip to content

Commit

Permalink
Minor comment/TODO/typo changes (review)
Browse files Browse the repository at this point in the history
  • Loading branch information
optout21 committed Jan 15, 2025
1 parent 7508eda commit 5f8c877
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lightning/src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4347,7 +4347,7 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
funding_feerate_per_kw: u32, locktime: u32,
) -> msgs::SpliceInit {
// Reuse the existing funding pubkey, in spite of the channel value changing
// (though at this point we don't know the new value yet, due tue the optional counterparty contribution)
// (though at this point we don't know the new value yet, due to the optional counterparty contribution)
// Note that channel_keys_id is supposed NOT to change
let funding_pubkey = self.get_holder_pubkeys().funding_pubkey.clone();
msgs::SpliceInit {
Expand Down Expand Up @@ -8119,7 +8119,7 @@ impl<SP: Deref> FundedChannel<SP> where
our_funding_inputs: Vec<(TxIn, Transaction)>, funding_feerate_per_kw: u32, locktime: u32,
) -> Result<msgs::SpliceInit, ChannelError> {
// Check if a splice has been initiated already.
// Note: this could be handled more nicely, and support multiple outstanding splice's, the incoming splice_ack matters anyways.
// Note: only a single outstanding splice is supported (per spec)
if let Some(splice_info) = &self.pending_splice_pre {
return Err(ChannelError::Warn(format!(
"Channel has already a splice pending, contribution {}", splice_info.our_funding_contribution
Expand All @@ -8130,6 +8130,8 @@ impl<SP: Deref> FundedChannel<SP> where
return Err(ChannelError::Warn(format!("Cannot initiate splicing, as channel is not Ready")));
}

// TODO(splicing): check for quiescence

let pre_channel_value = self.context.get_value_satoshis();
// Sanity check: capacity cannot decrease below 0
if (pre_channel_value as i64).saturating_add(our_funding_contribution_satoshis) < 0 {
Expand All @@ -8146,7 +8148,7 @@ impl<SP: Deref> FundedChannel<SP> where
)));
}

// Note: post-splice channel value is not yet known at this point, counterpary contribution is not known
// Note: post-splice channel value is not yet known at this point, counterparty contribution is not known
// (Cannot test for miminum required post-splice channel value)

// Check that inputs are sufficient to cover our contribution
Expand Down
2 changes: 2 additions & 0 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11462,6 +11462,7 @@ where
msg.channel_id)), counterparty_node_id);
}

/// TODO(splicing): Implement persisting
#[cfg(splicing)]
fn handle_splice_init(&self, counterparty_node_id: PublicKey, msg: &msgs::SpliceInit) {
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
Expand All @@ -11476,6 +11477,7 @@ where
});
}

/// TODO(splicing): Implement persisting
#[cfg(splicing)]
fn handle_splice_ack(&self, counterparty_node_id: PublicKey, msg: &msgs::SpliceAck) {
let _persistence_guard = PersistenceNotifierGuard::optionally_notify(self, || {
Expand Down

0 comments on commit 5f8c877

Please sign in to comment.