Skip to content

Commit

Permalink
fix: Set offered contract to rejected if channel gets cancelled.
Browse files Browse the repository at this point in the history
  • Loading branch information
holzeis committed Feb 15, 2024
1 parent 1534c18 commit cd2c53a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dlc-manager/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,9 @@ where
/// message to be sent as well as the public key of the offering node.
pub fn reject_channel(&self, channel_id: &DlcChannelId) -> Result<(Reject, PublicKey), Error> {
let offered_channel = get_channel_in_state!(self, channel_id, Offered, None as Option<PublicKey>)?;
let offered_contract = get_contract_in_state!(self, &offered_channel.offered_contract_id, Offered, None as Option<PublicKey>)?;
let counterparty = offered_channel.counter_party;
self.store.upsert_channel(Channel::Cancelled(offered_channel), None)?;
self.store.upsert_channel(Channel::Cancelled(offered_channel), Some(Contract::Rejected(offered_contract)))?;

let msg = Reject{ channel_id: *channel_id, timestamp: get_unix_time_now() };
Ok((msg, counterparty))
Expand Down

0 comments on commit cd2c53a

Please sign in to comment.