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: ACKab12410ae8
RCasatta: ACKab12410ae8
Tree-SHA512: dfba40d8ae597d97653e13ba2ab1480822d5d75343da487e3d3e57cf6821bcc567d5a883be6fd76a3e1c7d60925fedc3a5a864789cf6370c6ebda0b1d02acdd1
This commit is contained in:
commit
e5c6d6559d
|
@ -270,6 +270,8 @@ impl Amount {
|
||||||
pub const ONE_SAT: Amount = Amount(1);
|
pub const ONE_SAT: Amount = Amount(1);
|
||||||
/// Exactly one bitcoin.
|
/// Exactly one bitcoin.
|
||||||
pub const ONE_BTC: Amount = Amount(100_000_000);
|
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.
|
/// Create an [Amount] with satoshi precision and the given number of satoshis.
|
||||||
pub fn from_sat(satoshi: u64) -> Amount {
|
pub fn from_sat(satoshi: u64) -> Amount {
|
||||||
|
@ -555,6 +557,8 @@ impl SignedAmount {
|
||||||
pub const ONE_SAT: SignedAmount = SignedAmount(1);
|
pub const ONE_SAT: SignedAmount = SignedAmount(1);
|
||||||
/// Exactly one bitcoin.
|
/// Exactly one bitcoin.
|
||||||
pub const ONE_BTC: SignedAmount = SignedAmount(100_000_000);
|
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.
|
/// Create an [SignedAmount] with satoshi precision and the given number of satoshis.
|
||||||
pub fn from_sat(satoshi: i64) -> SignedAmount {
|
pub fn from_sat(satoshi: i64) -> SignedAmount {
|
||||||
|
|
Loading…
Reference in New Issue