feat(units): add kvb constructor to `FeeRate`

Namely, the feefilter expresses the fee as sat per 1000 vbyte
This commit is contained in:
Rob N 2024-11-12 08:13:53 -10:00
parent 73e33e5808
commit b96501981f
No known key found for this signature in database
GPG Key ID: F4DD8F8486EC0F1F
1 changed files with 3 additions and 0 deletions

View File

@ -62,6 +62,9 @@ impl FeeRate {
/// Constructs a new [`FeeRate`] from satoshis per virtual bytes without overflow check. /// Constructs a new [`FeeRate`] from satoshis per virtual bytes without overflow check.
pub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> Self { FeeRate(sat_vb * (1000 / 4)) } pub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> Self { FeeRate(sat_vb * (1000 / 4)) }
/// Constructs a new [`FeeRate`] from satoshis per kilo virtual bytes (1,000 vbytes).
pub const fn from_sat_per_kvb(sat_kvb: u64) -> Self { FeeRate(sat_kvb / 4) }
/// Returns raw fee rate. /// Returns raw fee rate.
/// ///
/// Can be used instead of `into()` to avoid inference issues. /// Can be used instead of `into()` to avoid inference issues.