From 6cec7357ca96640daed99e59f4b4606727a322a6 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Mon, 25 Aug 2025 13:27:50 -0500 Subject: [PATCH 1/2] Use MAX_MSATS instead of magic value --- src/amount.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amount.rs b/src/amount.rs index 5ff8f71..6fa826c 100644 --- a/src/amount.rs +++ b/src/amount.rs @@ -89,8 +89,8 @@ impl Amount { #[inline] pub const fn saturating_add(self, rhs: Amount) -> Amount { match self.0.checked_add(rhs.0) { - Some(amt) if amt <= 21_000_000_0000_0000_000 => Amount(amt), - _ => Amount(21_000_000_0000_0000_000), + Some(amt) if amt <= MAX_MSATS => Amount(amt), + _ => Amount(MAX_MSATS), } } From d92d64e6e904a5379eb0fdddfa674302d8e0c0fd Mon Sep 17 00:00:00 2001 From: benthecarman Date: Mon, 25 Aug 2025 13:28:02 -0500 Subject: [PATCH 2/2] Fix typo --- src/amount.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amount.rs b/src/amount.rs index 6fa826c..1002b5a 100644 --- a/src/amount.rs +++ b/src/amount.rs @@ -10,7 +10,7 @@ use core::fmt; /// An amount of Bitcoin /// -/// Sadly, because lightning uses "milli-satoshis" we cannot directly use rust-bitcon's `Amount` +/// Sadly, because lightning uses "milli-satoshis" we cannot directly use rust-bitcoin's `Amount` /// type. /// /// In general, when displaying amounts to the user, you should use [`Self::sats_rounding_up`].