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

Add is_anchor to MutinyChannel #1176

Merged
merged 1 commit into from
May 9, 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
8 changes: 8 additions & 0 deletions mutiny-core/src/nodemanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ pub struct MutinyChannel {
pub confirmations: u32,
pub is_outbound: bool,
pub is_usable: bool,
pub is_anchor: bool,
}

impl From<&ChannelDetails> for MutinyChannel {
Expand All @@ -151,6 +152,12 @@ impl From<&ChannelDetails> for MutinyChannel {
// account for in balance and inbound
let reserve = size - (balance + inbound);

let is_anchor = c
.channel_type
.as_ref()
.map(|t| t.supports_anchors_zero_fee_htlc_tx())
.unwrap_or(false);

MutinyChannel {
user_chan_id: c.user_channel_id.to_be_bytes().to_lower_hex_string(),
balance,
Expand All @@ -163,6 +170,7 @@ impl From<&ChannelDetails> for MutinyChannel {
confirmations: c.confirmations.unwrap_or(0),
is_outbound: c.is_outbound,
is_usable: c.is_usable,
is_anchor,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions mutiny-wasm/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ pub struct MutinyChannel {
pub confirmations: u32,
pub is_outbound: bool,
pub is_usable: bool,
pub is_anchor: bool,
}

#[wasm_bindgen]
Expand Down Expand Up @@ -343,6 +344,7 @@ impl From<nodemanager::MutinyChannel> for MutinyChannel {
confirmations: m.confirmations,
is_outbound: m.is_outbound,
is_usable: m.is_usable,
is_anchor: m.is_anchor,
}
}
}
Expand All @@ -363,6 +365,7 @@ impl From<MutinyChannel> for nodemanager::MutinyChannel {
confirmations: m.confirmations,
is_outbound: m.is_outbound,
is_usable: m.is_usable,
is_anchor: m.is_anchor,
}
}
}
Expand Down
Loading