Skip to content

Commit

Permalink
Merge pull request #1134 from MutinyWallet/min-fee-lsps
Browse files Browse the repository at this point in the history
Set min lightning amount to 1 if LSPS
  • Loading branch information
TonyGiorgio authored Apr 11, 2024
2 parents 1beaa65 + ba73cee commit 4032199
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions mutiny-core/src/lsp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ impl<S: MutinyStorage> AnyLsp<S> {
AnyLsp::Lsps(_) => true,
}
}

pub fn is_lsps(&self) -> bool {
matches!(self, AnyLsp::Lsps(_))
}
}

#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
Expand Down
4 changes: 2 additions & 2 deletions mutiny-core/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ impl<S: MutinyStorage> Node<S> {
let min_amount_sat = if has_inbound_capacity {
1
} else {
utils::min_lightning_amount(self.network)
utils::min_lightning_amount(self.network, lsp.is_lsps())
};

if amount_sat < min_amount_sat {
Expand Down Expand Up @@ -1117,7 +1117,7 @@ impl<S: MutinyStorage> Node<S> {
let min_amount_sat = if has_inbound_capacity {
1
} else {
utils::min_lightning_amount(self.network)
utils::min_lightning_amount(self.network, lsp.is_lsps())
};

if amount_sat < min_amount_sat {
Expand Down
5 changes: 4 additions & 1 deletion mutiny-core/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ use std::str::FromStr;

pub const FETCH_TIMEOUT: i32 = 30_000;

pub(crate) fn min_lightning_amount(network: Network) -> u64 {
pub(crate) fn min_lightning_amount(network: Network, is_lsps: bool) -> u64 {
if is_lsps {
return 1;
}
match network {
Network::Bitcoin => 100_000,
Network::Testnet | Network::Signet | Network::Regtest => 10_000,
Expand Down

0 comments on commit 4032199

Please sign in to comment.