FeePerUnit

Tagged wrapper around FeeFrac to avoid unit confusion.

Synopsis

Declared in <util/feefrac.h>

template<typename Tag>
struct FeePerUnit
    : FeeFrac

Base Classes

NameDescription
FeeFracData structure storing a fee and size.

Member Functions

NameDescription
operator= Copy-assign the fee and size from another FeeFrac.
EvaluateFee Compute the fee for a given size at_size using this object's feerate.
EvaluateFeeDown Compute the fee for a given size at_size using this object's feerate, rounding down.
EvaluateFeeUp Compute the fee for a given size at_size using this object's feerate, rounding up.
IsEmpty Check if this is empty (size and fee are 0).
operator+= Add fee and size of another FeeFrac to this one.
operator-= Subtract fee and size of another FeeFrac from this one.

Static Member Functions

NameDescription
Div Helper function for 96/32 signed division, rounding towards negative infinity (if round_down), or towards positive infinity (if !round_down). This is a version relying on __int128.
DivFallback Helper function for 96/32 signed division, rounding towards negative infinity (if round_down) or positive infinity (if !round_down). This is a fallback version, separate so that it can be tested on platforms where it isn't actually needed.
FromFeeFrac Convert a FeeFrac to a FeePerUnit.
Mul Helper function for 32*64 signed multiplication, returning an unspecified but totally ordered type. This is a version relying on __int128.
MulFallback Helper function for 32*64 signed multiplication, returning an unspecified but totally ordered type. This is a fallback version, separate so it can be tested on platforms where it isn't actually needed.

Data Members

NameDescription
fee The fee, in satoshis.
size The size, in the unit chosen by the caller (for example vbytes or weight units).

Using Declarations

NameDescription
FeePerUnit Inherit the FeeFrac constructors.

Non-Member Functions

NameDescription
operator+Sum fee and size.
operator-Subtract both fee and size.
operator==Check if two FeeFrac objects are equal (both same fee and same size).
swapSwap two FeeFracs.