Tagged wrapper around FeeFrac to avoid unit confusion.

Synopsis

Declared in <util/feefrac.h>

template<typename Tag>
struct FeePerUnit
    : FeeFrac

Base Classes

Name

Description

FeeFrac

Data structure storing a fee and size.

Member Functions

Name

Description

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

Name

Description

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

Name

Description

fee

The fee, in satoshis.

size

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

Using Declarations

Name

Description

FeePerUnit

Inherit the FeeFrac constructors.

Non-Member Functions

Name

Description

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).

swap

Swap two FeeFracs.

Created with MrDocs