From 9384e1c0041169d7200c9000ba2bb83bad5c5f7e Mon Sep 17 00:00:00 2001 From: benthecarman Date: Wed, 8 May 2024 20:26:42 -0500 Subject: [PATCH] Add is_anchor to MutinyChannel --- mutiny-core/src/nodemanager.rs | 8 ++++++++ mutiny-wasm/src/models.rs | 3 +++ 2 files changed, 11 insertions(+) diff --git a/mutiny-core/src/nodemanager.rs b/mutiny-core/src/nodemanager.rs index a048f692f..15d24e79d 100644 --- a/mutiny-core/src/nodemanager.rs +++ b/mutiny-core/src/nodemanager.rs @@ -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 { @@ -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, @@ -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, } } } diff --git a/mutiny-wasm/src/models.rs b/mutiny-wasm/src/models.rs index 75c50f493..7978c2e04 100644 --- a/mutiny-wasm/src/models.rs +++ b/mutiny-wasm/src/models.rs @@ -296,6 +296,7 @@ pub struct MutinyChannel { pub confirmations: u32, pub is_outbound: bool, pub is_usable: bool, + pub is_anchor: bool, } #[wasm_bindgen] @@ -343,6 +344,7 @@ impl From for MutinyChannel { confirmations: m.confirmations, is_outbound: m.is_outbound, is_usable: m.is_usable, + is_anchor: m.is_anchor, } } } @@ -363,6 +365,7 @@ impl From for nodemanager::MutinyChannel { confirmations: m.confirmations, is_outbound: m.is_outbound, is_usable: m.is_usable, + is_anchor: m.is_anchor, } } }