Skip to content

Commit

Permalink
Merge #902: util::amount: Make from_sat constructor constant
Browse files Browse the repository at this point in the history
31571ca 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 31571ca
  apoelstra:
    ACK 31571ca

Tree-SHA512: f254eb10a4349d890e29ea5fae77536429c7e731362cf2edcf2fe98ec9cbf2d8bbf65f98dfc8f0b80bac89960de688005d066a116d6cb62cca1efa9c1151f2ae
  • Loading branch information
apoelstra committed Apr 22, 2022
2 parents b169925 + 31571ca commit 83514c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/amount.rs
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 83514c8

Please sign in to comment.