Add `transaction::fees::zip317::MINIMUM_FEE` constant and
`transaction::components::amount::Amount::const_from_i64`. Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
4cf27126e5
commit
043cc59c76
|
@ -67,6 +67,10 @@ and this library adheres to Rust's notion of
|
|||
- `merkle_tree::read_incremental_witness` replaces `merkle_tree::IncrementalWitness::read`
|
||||
- `merkle_tree::merkle_path_from_slice` replaces `merkle_tree::MerklePath::from_slice`
|
||||
- `sapling::{CommitmentTree, IncrementalWitness, MerklePath, NOTE_COMMITMENT_TREE_DEPTH}`
|
||||
- `transaction::fees::zip317::MINIMUM_FEE`, reflecting the minimum possible
|
||||
[ZIP 317](https://zips.z.cash/zip-0317) conventional fee.
|
||||
- `transaction::components::amount::Amount::const_from_i64`, intended for constructing
|
||||
a constant `Amount`.
|
||||
|
||||
### Changed
|
||||
- The bounds on the `H` parameter to the following methods have changed:
|
||||
|
|
|
@ -32,6 +32,14 @@ impl Amount {
|
|||
Amount(0)
|
||||
}
|
||||
|
||||
/// Creates a constant Amount from an i64.
|
||||
///
|
||||
/// Panics: if the amount is outside the range `{-MAX_MONEY..MAX_MONEY}`.
|
||||
pub const fn const_from_i64(amount: i64) -> Self {
|
||||
assert!(-MAX_MONEY <= amount && amount <= MAX_MONEY); // contains is not const
|
||||
Amount(amount)
|
||||
}
|
||||
|
||||
/// Creates an Amount from an i64.
|
||||
///
|
||||
/// Returns an error if the amount is outside the range `{-MAX_MONEY..MAX_MONEY}`.
|
||||
|
|
|
@ -13,6 +13,13 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
/// The minimum conventional fee using the standard [ZIP 317] constants. Equivalent to
|
||||
/// `(FeeRule::standard().marginal_fee() * FeeRule::standard().grace_actions()).unwrap()`,
|
||||
/// but as a constant.
|
||||
///
|
||||
/// [ZIP 317]: https//zips.z.cash/zip-0317
|
||||
pub const MINIMUM_FEE: Amount = Amount::const_from_i64(10_000);
|
||||
|
||||
/// A [`FeeRule`] implementation that implements the [ZIP 317] fee rule.
|
||||
///
|
||||
/// This fee rule supports only P2pkh transparent inputs; an error will be returned if a coin
|
||||
|
|
Loading…
Reference in New Issue