Skip to content

Commit

Permalink
fix: Propose the settled amount when collab closing a channel
Browse files Browse the repository at this point in the history
  • Loading branch information
holzeis authored and bonomat committed Feb 10, 2024
1 parent 7a9f744 commit ca06397
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions crates/ln-dlc-node/src/node/dlc_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,18 @@ impl<S: TenTenOneStorage + 'static, N: LnDlcStorage + Sync + Send + 'static> Nod
let counterparty = channel.counter_party;

match channel.state {
SignedChannelState::Settled { .. } | SignedChannelState::RenewFinalized { .. } => {
SignedChannelState::Settled { counter_payout, .. } => {
spawn_blocking({
let dlc_manager = self.dlc_manager.clone();
let event_handler = self.event_handler.clone();
move || {
tracing::info!(
counter_payout,
channel_id = channel.channel_id.to_hex(),
"Proposing collaborative close"
);
let settle_offer = dlc_manager
.offer_collaborative_close(
&channel.channel_id,
channel.counter_params.collateral,
)
.offer_collaborative_close(&channel.channel_id, counter_payout)
.context(
"Could not propose to collaboratively close the dlc channel.",
)?;
Expand All @@ -171,8 +173,8 @@ impl<S: TenTenOneStorage + 'static, N: LnDlcStorage + Sync + Send + 'static> Nod
.await??;
}
_ => {
tracing::error!( state = %channel.state, "Can't collaboratively close a channel with an open position.");
bail!("Can't collaboratively close a channel with an open position");
tracing::error!( state = %channel.state, "Can't collaboratively close a channel which is not settled.");
bail!("Can't collaboratively close a channel which is not settled");
}
}

Expand Down

0 comments on commit ca06397

Please sign in to comment.