Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add funding txid to list dlc channels api #1920

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Chore: Add funding txid to list dlc channels api

## [1.8.3] - 2024-01-26

- Chore: Set minimum quantity to 1 if dlc channel is open
Expand Down
7 changes: 5 additions & 2 deletions crates/ln-dlc-node/src/ln/dlc_channel_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct DlcChannelDetails {
pub signed_channel_state: Option<SignedChannelState>,
pub update_idx: Option<u64>,
pub fee_rate_per_vb: Option<u64>,
pub funding_txid: Option<String>,
}

#[derive(Serialize, Debug)]
Expand Down Expand Up @@ -49,13 +50,14 @@ pub enum ChannelState {

impl From<Channel> for DlcChannelDetails {
fn from(channel: Channel) -> Self {
let (update_idx, state, fee_rate_per_vb) = match channel.clone() {
let (update_idx, state, fee_rate_per_vb, funding_txid) = match channel.clone() {
Channel::Signed(signed_channel) => (
Some(signed_channel.update_idx),
Some(SignedChannelState::from(signed_channel.state)),
Some(signed_channel.fee_rate_per_vb),
Some(signed_channel.fund_tx.txid().to_hex()),
),
_ => (None, None, None),
_ => (None, None, None, None),
};

DlcChannelDetails {
Expand All @@ -65,6 +67,7 @@ impl From<Channel> for DlcChannelDetails {
signed_channel_state: state.map(SignedChannelState::from),
update_idx,
fee_rate_per_vb,
funding_txid,
}
}
}
Expand Down
Loading