Add FIFTY_BTC const to the amount types
The mining reward for the first epoc is 50 bitcoin. For mainnet this is old news but for regtest it is still relevant. Add and use a new const `FIFTY_BTC` to the `Amount` type. To keep the amount types uniform also add it to the `SignedAmount`.
This commit is contained in:
parent
dc76043dcf
commit
5eb5941215
|
@ -49,7 +49,7 @@ const UTXO_1: P2trUtxo = P2trUtxo {
|
|||
script_pubkey: UTXO_SCRIPT_PUBKEY,
|
||||
pubkey: UTXO_PUBKEY,
|
||||
master_fingerprint: UTXO_MASTER_FINGERPRINT,
|
||||
amount_in_sats: Amount::from_int_btc_const(50),
|
||||
amount_in_sats: Amount::FIFTY_BTC,
|
||||
derivation_path: BIP86_DERIVATION_PATH,
|
||||
};
|
||||
|
||||
|
@ -60,7 +60,7 @@ const UTXO_2: P2trUtxo = P2trUtxo {
|
|||
script_pubkey: UTXO_SCRIPT_PUBKEY,
|
||||
pubkey: UTXO_PUBKEY,
|
||||
master_fingerprint: UTXO_MASTER_FINGERPRINT,
|
||||
amount_in_sats: Amount::from_int_btc_const(50),
|
||||
amount_in_sats: Amount::FIFTY_BTC,
|
||||
derivation_path: BIP86_DERIVATION_PATH,
|
||||
};
|
||||
|
||||
|
@ -71,7 +71,7 @@ const UTXO_3: P2trUtxo = P2trUtxo {
|
|||
script_pubkey: UTXO_SCRIPT_PUBKEY,
|
||||
pubkey: UTXO_PUBKEY,
|
||||
master_fingerprint: UTXO_MASTER_FINGERPRINT,
|
||||
amount_in_sats: Amount::from_int_btc_const(50),
|
||||
amount_in_sats: Amount::FIFTY_BTC,
|
||||
derivation_path: BIP86_DERIVATION_PATH,
|
||||
};
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ fn bitcoin_genesis_tx(params: &Params) -> Transaction {
|
|||
});
|
||||
|
||||
ret.output.push(TxOut {
|
||||
value: Amount::from_sat_unchecked(50 * 100_000_000),
|
||||
value: Amount::FIFTY_BTC,
|
||||
script_pubkey: out_script,
|
||||
});
|
||||
|
||||
|
|
|
@ -55,6 +55,8 @@ impl SignedAmount {
|
|||
pub const ONE_SAT: Self = SignedAmount(1);
|
||||
/// Exactly one bitcoin.
|
||||
pub const ONE_BTC: Self = SignedAmount(100_000_000);
|
||||
/// Exactly fifty bitcoin.
|
||||
pub const FIFTY_BTC: Self = Self::from_sat_unchecked(50 * 100_000_000);
|
||||
/// The maximum value allowed as an amount. Useful for sanity checking.
|
||||
pub const MAX_MONEY: Self = SignedAmount(21_000_000 * 100_000_000);
|
||||
/// The minimum value of an amount.
|
||||
|
|
|
@ -58,6 +58,8 @@ impl Amount {
|
|||
pub const ONE_SAT: Self = Amount(1);
|
||||
/// Exactly one bitcoin.
|
||||
pub const ONE_BTC: Self = Self::from_int_btc_const(1);
|
||||
/// Exactly fifty bitcoin.
|
||||
pub const FIFTY_BTC: Self = Self::from_sat_unchecked(50 * 100_000_000);
|
||||
/// The maximum value allowed as an amount. Useful for sanity checking.
|
||||
pub const MAX_MONEY: Self = Self::from_int_btc_const(21_000_000);
|
||||
/// The minimum value of an amount.
|
||||
|
|
Loading…
Reference in New Issue