Skip to content

Commit

Permalink
Fix max amount
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Mar 26, 2024
1 parent cc1c6e1 commit ac0ec89
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lnurlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub async fn well_known_lnurlp(

let res = LnurlWellKnownResponse {
callback: format!("{}/lnurlp/{}/callback", state.domain, name).parse()?,
max_sendable: Amount { msats: 100000 },
max_sendable: Amount { msats: MAX_AMOUNT },
min_sendable: Amount { msats: MIN_AMOUNT },
metadata: calc_metadata(&name, &state.domain_no_http()),
comment_allowed: None,
Expand All @@ -44,7 +44,8 @@ pub async fn well_known_lnurlp(
Ok(res)
}

const MIN_AMOUNT: u64 = 1000;
const MAX_AMOUNT: u64 = 100_000_000 * 1_000; // 1 BTC
const MIN_AMOUNT: u64 = 1_000; // 1 sat

pub async fn lnurl_callback(
state: &State,
Expand All @@ -64,6 +65,13 @@ pub async fn lnurl_callback(
));
}

if params.amount > MAX_AMOUNT {
return Err(anyhow::anyhow!(
"Amount ({}) < MAX_AMOUNT ({MAX_AMOUNT})",
params.amount
));
}

// verify nostr param is a zap request
if params
.nostr
Expand Down

0 comments on commit ac0ec89

Please sign in to comment.