From 31571cafbdc161ad3cc23e7bd6e52f242b03f055 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Wed, 23 Mar 2022 15:15:08 +0000 Subject: [PATCH] util::amount: Make from_sat constructor constant --- src/util/amount.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/amount.rs b/src/util/amount.rs index c9cca684..b58a1d78 100644 --- a/src/util/amount.rs +++ b/src/util/amount.rs @@ -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) } @@ -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) }