diff --git a/src/channel.rs b/src/channel.rs index 1057f87..dbf6185 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -22,8 +22,8 @@ pub async fn open_channel( x_forwarded_for: &str, payload: ChannelRequest, ) -> anyhow::Result { - if payload.capacity > MAX_SEND_AMOUNT.try_into().unwrap() { - anyhow::bail!("max capacity is 10,000,000"); + if payload.capacity > MAX_SEND_AMOUNT.try_into()? { + anyhow::bail!("max capacity is 1,000,000"); } if payload.push_amount < 0 { anyhow::bail!("push_amount must be positive"); @@ -32,7 +32,7 @@ pub async fn open_channel( anyhow::bail!("push_amount must be less than or equal to capacity"); } - let node_pubkey_result = hex::decode(payload.pubkey.clone()); + let node_pubkey_result = hex::decode(&payload.pubkey); let node_pubkey = match node_pubkey_result { Ok(pubkey) => pubkey, Err(e) => anyhow::bail!("invalid pubkey: {}", e), diff --git a/src/lightning.rs b/src/lightning.rs index a270e0c..fe54bb0 100644 --- a/src/lightning.rs +++ b/src/lightning.rs @@ -33,7 +33,7 @@ pub async fn pay_lightning( let invoice = if let Some(invoice) = params.invoice() { if let Some(msat_amount) = invoice.amount_milli_satoshis() { if msat_amount / 1000 > MAX_SEND_AMOUNT { - anyhow::bail!("max amount is 10,000,000"); + anyhow::bail!("max amount is 1,000,000"); } invoice } else { @@ -43,7 +43,7 @@ pub async fn pay_lightning( match state.lnurl.make_request(&lnurl.url).await? { LnUrlResponse::LnUrlPayResponse(pay) => { if pay.min_sendable > MAX_SEND_AMOUNT { - anyhow::bail!("max amount is 10,000,000"); + anyhow::bail!("max amount is 1,000,000"); } let inv = state .lnurl @@ -78,7 +78,7 @@ pub async fn pay_lightning( match state.lnurl.make_request(&lnurl.url).await? { LnUrlResponse::LnUrlPayResponse(pay) => { if pay.min_sendable > MAX_SEND_AMOUNT { - anyhow::bail!("max amount is 10,000,000"); + anyhow::bail!("max amount is 1,000,000"); } let relays = RELAYS.iter().map(|r| UncheckedUrl::new(*r)); diff --git a/src/main.rs b/src/main.rs index fa46415..a4ab739 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,7 +64,7 @@ impl AppState { } } -const MAX_SEND_AMOUNT: u64 = 10_000_000; +const MAX_SEND_AMOUNT: u64 = 1_000_000; #[tokio::main] async fn main() -> anyhow::Result<()> { diff --git a/src/nostr_dms.rs b/src/nostr_dms.rs index b1b94bd..e0fc9b4 100644 --- a/src/nostr_dms.rs +++ b/src/nostr_dms.rs @@ -13,12 +13,7 @@ use nostr_sdk::{Client, RelayPoolNotification}; use std::str::FromStr; use tonic_openssl_lnd::lnrpc; -pub const RELAYS: [&str; 4] = [ - "wss://nostr.mutinywallet.com", - "wss://relay.mutinywallet.com", - "wss://relay.primal.net", - "wss://relay.damus.io", -]; +pub const RELAYS: [&str; 2] = ["wss://relay.primal.net", "wss://relay.damus.io"]; pub async fn listen_to_nostr_dms(state: AppState) -> anyhow::Result<()> { loop { @@ -124,7 +119,7 @@ async fn get_invoice( LnUrlResponse::LnUrlPayResponse(pay) => { let amount_msats = pay.min_sendable * 2; if amount_msats > MAX_SEND_AMOUNT { - anyhow::bail!("max amount is 10,000,000"); + anyhow::bail!("max amount is 1,000,000"); } let relays = RELAYS.iter().map(|r| UncheckedUrl::new(*r)); diff --git a/src/onchain.rs b/src/onchain.rs index 294290e..e89c85f 100644 --- a/src/onchain.rs +++ b/src/onchain.rs @@ -48,7 +48,7 @@ pub async fn pay_onchain( .ok_or(anyhow::anyhow!("invalid amount"))?; if amount.to_sat() > MAX_SEND_AMOUNT { - anyhow::bail!("max amount is 10,000,000"); + anyhow::bail!("max amount is 1,000,000"); } let resp = {