util::amount: Make from_sat constructor constant

This commit is contained in:
Steven Roose 2022-03-23 15:15:08 +00:00
parent 1295008dc6
commit 31571cafbd
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
1 changed files with 2 additions and 2 deletions

View File

@ -346,7 +346,7 @@ impl Amount {
pub const MAX_MONEY: Amount = Amount(21_000_000 * 100_000_000); pub const MAX_MONEY: Amount = Amount(21_000_000 * 100_000_000);
/// Create an [Amount] with satoshi precision and the given number of satoshis. /// 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) Amount(satoshi)
} }
@ -633,7 +633,7 @@ impl SignedAmount {
pub const MAX_MONEY: SignedAmount = SignedAmount(21_000_000 * 100_000_000); pub const MAX_MONEY: SignedAmount = SignedAmount(21_000_000 * 100_000_000);
/// Create an [SignedAmount] with satoshi precision and the given number of satoshis. /// 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) SignedAmount(satoshi)
} }