Merge rust-bitcoin/rust-bitcoin#1410: Change `max_money` to a constant.

e9dffb1b7b Change `max_money` to a constant. (Martin Habovstiak)

Pull request description:

  The value is statically known which is better expressed as a constant. Also allows usage in const context.

ACKs for top commit:
  apoelstra:
    ACK e9dffb1b7b
  tcharding:
    ACK e9dffb1b7b
  ariard:
    ACK e9dffb1
  sanket1729:
    ACK e9dffb1b7b

Tree-SHA512: b9b80d573531fe75dce22e185a1c84b2885160334418d1cfbd7279684fd4229c3c6c4041d3a3badb3652c5723e90ff52d3c761cbc3bff7b73978776694a67422
This commit is contained in:
Andrew Poelstra 2022-12-03 13:49:07 +00:00
commit 29704f2872
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 1 additions and 3 deletions

View File

@ -60,9 +60,7 @@ pub const MAX_SCRIPTNUM_VALUE: u32 = 0x80000000; // 2^31
/// The maximum value allowed in an output (useful for sanity checking, /// The maximum value allowed in an output (useful for sanity checking,
/// since keeping everything below this value should prevent overflows /// since keeping everything below this value should prevent overflows
/// if you are doing anything remotely sane with monetary values). /// if you are doing anything remotely sane with monetary values).
pub fn max_money() -> u64 { pub const MAX_MONEY: u64 = 21_000_000 * COIN_VALUE;
21_000_000 * COIN_VALUE
}
/// Constructs and returns the coinbase (and only) transaction of the Bitcoin genesis block /// Constructs and returns the coinbase (and only) transaction of the Bitcoin genesis block
fn bitcoin_genesis_tx() -> Transaction { fn bitcoin_genesis_tx() -> Transaction {