Skip to content

Commit

Permalink
fix: show only usable balance in trade constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
bonomat committed Jan 17, 2024
1 parent a1c7fa5 commit b022466
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mobile/native/src/channel_trade_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn channel_trade_constraints() -> Result<TradeConstraints> {
}
}
Some(channel) => TradeConstraints {
max_local_margin_sats: channel.own_params.collateral,
max_local_margin_sats: ln_dlc::get_usable_dlc_channel_balance()?.to_sat(),
max_counterparty_margin_sats: channel.counter_params.collateral,
coordinator_leverage,
min_quantity,
Expand Down
4 changes: 4 additions & 0 deletions mobile/native/src/ln_dlc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ pub fn get_onchain_balance() -> Result<Balance> {
let node = state::try_get_node().context("failed to get ln dlc node")?;
node.inner.get_on_chain_balance()
}
pub fn get_usable_dlc_channel_balance() -> Result<Amount> {
let node = state::try_get_node().context("failed to get ln dlc node")?;
node.inner.get_dlc_channels_usable_balance()
}

pub fn collaborative_revert_channel(
channel_id: DlcChannelId,
Expand Down

0 comments on commit b022466

Please sign in to comment.