Skip to content

Commit

Permalink
Merge pull request #1821 from get10101/fix/accept-collab-close-offer-…
Browse files Browse the repository at this point in the history
…from-coordinator

fix: Accept collaborative close offer from coordinator
  • Loading branch information
holzeis authored Jan 18, 2024
2 parents f909c96 + 22e9c49 commit 488aa16
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions mobile/native/src/ln_dlc/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ impl Node {
/// - Any dlc channel message that has already been processed will be skipped.
///
/// If an offer is received [`ChannelMessage::Offer`], [`ChannelMessage::SettleOffer`],
/// [`ChannelMessage::RenewOffer`] will get automatically accepted. Unless the maturity date of
/// the offer is already outdated.
/// [`ChannelMessage::CollaborativeCloseOffer`], [`ChannelMessage::RenewOffer`] will get
/// automatically accepted. Unless the maturity date of the offer is already outdated.
///
/// FIXME(holzeis): This function manipulates different data objects in different data sources
/// and should use a transaction to make all changes atomic. Not doing so risks of ending up in
Expand Down Expand Up @@ -306,6 +306,18 @@ impl Node {
BackgroundTask::RecoverDlc(TaskStatus::Success),
));
}
ChannelMessage::CollaborativeCloseOffer(close_offer) => {
let channel_id_hex_string = close_offer.channel_id.to_hex();
tracing::info!(
channel_id = channel_id_hex_string,
node_id = node_id.to_string(),
"Received an offer to collaboratively close a channel"
);

// TODO(bonomat): we should verify that the proposed amount is acceptable
self.inner
.accept_dlc_channel_collaborative_close(close_offer.channel_id)?;
}
_ => (),
}

Expand Down

0 comments on commit 488aa16

Please sign in to comment.