Struct FeeRate
pub struct FeeRate(/* private fields */);
Expand description
Represents fee rate.
This is an integer newtype representing fee rate in sat/kwu
. It provides protection against mixing
up the types as well as basic formatting features.
Implementations§
§impl FeeRate
impl FeeRate
pub const ZERO: FeeRate = _
pub const ZERO: FeeRate = _
0 sat/kwu.
Equivalent to MIN
, may better express intent in some contexts.
pub const MIN: FeeRate = FeeRate::ZERO
pub const MIN: FeeRate = FeeRate::ZERO
Minimum possible value (0 sat/kwu).
Equivalent to ZERO
, may better express intent in some contexts.
pub const BROADCAST_MIN: FeeRate = _
pub const BROADCAST_MIN: FeeRate = _
Minimum fee rate required to broadcast a transaction.
The value matches the default Bitcoin Core policy at the time of library release.
pub const fn from_sat_per_kwu(sat_kwu: u64) -> FeeRate
pub const fn from_sat_per_kwu(sat_kwu: u64) -> FeeRate
Constructs FeeRate
from satoshis per 1000 weight units.
pub fn from_sat_per_vb(sat_vb: u64) -> Option<FeeRate>
pub fn from_sat_per_vb(sat_vb: u64) -> Option<FeeRate>
pub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> FeeRate
pub const fn from_sat_per_vb_unchecked(sat_vb: u64) -> FeeRate
Constructs FeeRate
from satoshis per virtual bytes without overflow check.
pub const fn to_sat_per_kwu(self) -> u64
pub const fn to_sat_per_kwu(self) -> u64
Returns raw fee rate.
Can be used instead of into()
to avoid inference issues.
pub const fn to_sat_per_vb_floor(self) -> u64
pub const fn to_sat_per_vb_floor(self) -> u64
Converts to sat/vB rounding down.
pub const fn to_sat_per_vb_ceil(self) -> u64
pub const fn to_sat_per_vb_ceil(self) -> u64
Converts to sat/vB rounding up.
pub fn checked_mul(self, rhs: u64) -> Option<FeeRate>
pub fn checked_mul(self, rhs: u64) -> Option<FeeRate>
Checked multiplication.
Computes self * rhs
returning None
if overflow occurred.
pub fn checked_div(self, rhs: u64) -> Option<FeeRate>
pub fn checked_div(self, rhs: u64) -> Option<FeeRate>
Checked division.
Computes self / rhs
returning None
if rhs == 0
.
pub fn checked_mul_by_weight(self, rhs: Weight) -> Option<Amount>
pub fn checked_mul_by_weight(self, rhs: Weight) -> Option<Amount>
Checked weight multiplication.
Computes the absolute fee amount for a given Weight
at this fee rate.
None
is returned if an overflow occurred.