Merge rust-bitcoin/rust-bitcoin#902: util::amount: Make from_sat constructor constant

31571cafbd util::amount: Make from_sat constructor constant (Steven Roose)

Pull request description:

  Currently unmergable because of MSRV but I heard talk about bumping it, so once it's bumped, this is a very much needed change :)

ACKs for top commit:
  tcharding:
    ACK 31571cafbd
  apoelstra:
    ACK 31571cafbd

Tree-SHA512: f254eb10a4349d890e29ea5fae77536429c7e731362cf2edcf2fe98ec9cbf2d8bbf65f98dfc8f0b80bac89960de688005d066a116d6cb62cca1efa9c1151f2ae
This commit is contained in:
Andrew Poelstra 2022-04-22 23:27:40 +00:00
commit 83514c87a7
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
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)
} }