mina_tree/scan_state/fee_rate.rs
1use crate::scan_state::currency::Magnitude;
2
3use super::currency::Fee;
4use serde::{Deserialize, Serialize};
5
6#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Hash, Serialize, Deserialize)]
7pub struct FeeRate {
8 q: fraction::Fraction,
9}
10
11impl FeeRate {
12 pub fn make_exn(fee: Fee, weight: u64) -> Self {
13 if weight == 0 {
14 assert!(fee.is_zero());
15 }
16
17 Self {
18 q: fraction::Fraction::new(fee.as_u64(), weight),
19 }
20 }
21}