Merge rust-bitcoin/rust-bitcoin#742: add MAX_MONEY public constant to Amount

ab12410ae8 add MAX_MONEY public constant to Amount (z8674558)

Pull request description:

  Closes https://github.com/rust-bitcoin/rust-bitcoin/issues/740

ACKs for top commit:
  Kixunil:
    ACK ab12410ae8
  RCasatta:
    ACK ab12410ae8

Tree-SHA512: dfba40d8ae597d97653e13ba2ab1480822d5d75343da487e3d3e57cf6821bcc567d5a883be6fd76a3e1c7d60925fedc3a5a864789cf6370c6ebda0b1d02acdd1
This commit is contained in:
Riccardo Casatta 2021-12-16 09:27:32 +01:00
commit e5c6d6559d
No known key found for this signature in database
GPG Key ID: FD986A969E450397
1 changed files with 4 additions and 0 deletions

View File

@ -270,6 +270,8 @@ impl Amount {
pub const ONE_SAT: Amount = Amount(1);
/// Exactly one bitcoin.
pub const ONE_BTC: Amount = Amount(100_000_000);
/// The maximum value allowed as an amount. Useful for sanity checking.
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 {
@ -555,6 +557,8 @@ impl SignedAmount {
pub const ONE_SAT: SignedAmount = SignedAmount(1);
/// Exactly one bitcoin.
pub const ONE_BTC: SignedAmount = SignedAmount(100_000_000);
/// The maximum value allowed as an amount. Useful for sanity checking.
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 {