Skip to content

Commit

Permalink
util::amount: Make from_sat constructor constant
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed Mar 23, 2022
1 parent 1295008 commit 31571ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl Amount {
pub const MAX_MONEY: Amount = Amount(21_000_000 * 100_000_000);

/// Create an [Amount] with satoshi precision and the given number of satoshis.
pub fn from_sat(satoshi: u64) -> Amount {
pub const fn from_sat(satoshi: u64) -> Amount {
Amount(satoshi)
}

Expand Down Expand Up @@ -633,7 +633,7 @@ impl SignedAmount {
pub const MAX_MONEY: SignedAmount = SignedAmount(21_000_000 * 100_000_000);

/// Create an [SignedAmount] with satoshi precision and the given number of satoshis.
pub fn from_sat(satoshi: i64) -> SignedAmount {
pub const fn from_sat(satoshi: i64) -> SignedAmount {
SignedAmount(satoshi)
}

Expand Down

0 comments on commit 31571ca

Please sign in to comment.