Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add comments to length_to_fee and weight_to_fee
Browse files Browse the repository at this point in the history
  • Loading branch information
notlesh committed Jan 11, 2023
1 parent 0ae8033 commit 9767e6b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frame/transaction-payment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,13 @@ where
}
}

/// Compute the length portion of a fee by invoking the configured `LengthToFee` impl.
pub fn length_to_fee(length: u32) -> BalanceOf<T> {
T::LengthToFee::weight_to_fee(&Weight::from_ref_time(length as u64))
}

/// Compute the unadjusted portion of the weight fee by invoking the configured `WeightToFee`
/// impl. Note that the input `weight` is capped by the maximum block weight before computation.
pub fn weight_to_fee(weight: Weight) -> BalanceOf<T> {
// cap the weight to the maximum defined in runtime, otherwise it will be the
// `Bounded` maximum of its data type, which is not desired.
Expand Down

0 comments on commit 9767e6b

Please sign in to comment.