Skip to content

Commit

Permalink
Merge pull request #1176 from MutinyWallet/is-anchor
Browse files Browse the repository at this point in the history
Add is_anchor to MutinyChannel
  • Loading branch information
benthecarman authored May 9, 2024
2 parents 4ea794a + 9384e1c commit 816782a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 816782a

Please sign in to comment.