Skip to content

Commit ce68b1d

Browse files
authored
Merge pull request #10 from benthecarman/magic-val
Use MAX_MSATS instead of magic value
2 parents d071ce2 + d92d64e commit ce68b1d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/amount.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use core::fmt;
1010

1111
/// An amount of Bitcoin
1212
///
13-
/// Sadly, because lightning uses "milli-satoshis" we cannot directly use rust-bitcon's `Amount`
13+
/// Sadly, because lightning uses "milli-satoshis" we cannot directly use rust-bitcoin's `Amount`
1414
/// type.
1515
///
1616
/// In general, when displaying amounts to the user, you should use [`Self::sats_rounding_up`].
@@ -89,8 +89,8 @@ impl Amount {
8989
#[inline]
9090
pub const fn saturating_add(self, rhs: Amount) -> Amount {
9191
match self.0.checked_add(rhs.0) {
92-
Some(amt) if amt <= 21_000_000_0000_0000_000 => Amount(amt),
93-
_ => Amount(21_000_000_0000_0000_000),
92+
Some(amt) if amt <= MAX_MSATS => Amount(amt),
93+
_ => Amount(MAX_MSATS),
9494
}
9595
}
9696

0 commit comments

Comments
 (0)