Bitcoin Core 29.99.0
P2P Digital Currency
Public Member Functions | Private Attributes | Friends | List of all members
CFeeRate Class Reference

Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac. More...

#include <feerate.h>

Collaboration diagram for CFeeRate:
[legend]

Public Member Functions

 CFeeRate ()=default
 Fee rate of 0 satoshis per 0 vB. More...
 
template<std::integral I>
 CFeeRate (const I m_feerate_kvb)
 
 CFeeRate (const CAmount &nFeePaid, int32_t virtual_bytes)
 Construct a fee rate from a fee in satoshis and a vsize in vB. More...
 
CAmount GetFee (int32_t virtual_bytes) const
 Return the fee in satoshis for the given vsize in vbytes. More...
 
CAmount GetFeePerK () const
 Return the fee in satoshis for a vsize of 1000 vbytes. More...
 
CFeeRateoperator+= (const CFeeRate &a)
 
std::string ToString (const FeeEstimateMode &fee_estimate_mode=FeeEstimateMode::BTC_KVB) const
 
 SERIALIZE_METHODS (CFeeRate, obj)
 

Private Attributes

FeePerVSize m_feerate
 Fee rate in sats/vB (satoshis per N virtualbytes) More...
 

Friends

std::weak_ordering operator<=> (const CFeeRate &a, const CFeeRate &b) noexcept
 
bool operator== (const CFeeRate &a, const CFeeRate &b) noexcept
 
CFeeRate operator* (const CFeeRate &f, int a)
 
CFeeRate operator* (int a, const CFeeRate &f)
 

Detailed Description

Fee rate in satoshis per virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac.

Definition at line 34 of file feerate.h.

Constructor & Destructor Documentation

◆ CFeeRate() [1/3]

CFeeRate::CFeeRate ( )
default

Fee rate of 0 satoshis per 0 vB.

◆ CFeeRate() [2/3]

template<std::integral I>
CFeeRate::CFeeRate ( const I  m_feerate_kvb)
inlineexplicit

Definition at line 44 of file feerate.h.

◆ CFeeRate() [3/3]

CFeeRate::CFeeRate ( const CAmount nFeePaid,
int32_t  virtual_bytes 
)

Construct a fee rate from a fee in satoshis and a vsize in vB.

Passing any virtual_bytes less than or equal to 0 will result in 0 fee rate per 0 size.

Definition at line 11 of file feerate.cpp.

Member Function Documentation

◆ GetFee()

CAmount CFeeRate::GetFee ( int32_t  virtual_bytes) const

Return the fee in satoshis for the given vsize in vbytes.

If the calculated fee would have fractional satoshis, then the returned fee will always be rounded up to the nearest satoshi.

Definition at line 20 of file feerate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetFeePerK()

CAmount CFeeRate::GetFeePerK ( ) const
inline

Return the fee in satoshis for a vsize of 1000 vbytes.

Definition at line 63 of file feerate.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator+=()

CFeeRate & CFeeRate::operator+= ( const CFeeRate a)
inline

Definition at line 72 of file feerate.h.

Here is the call graph for this function:

◆ SERIALIZE_METHODS()

CFeeRate::SERIALIZE_METHODS ( CFeeRate  ,
obj   
)
inline

Definition at line 80 of file feerate.h.

◆ ToString()

std::string CFeeRate::ToString ( const FeeEstimateMode fee_estimate_mode = FeeEstimateMode::BTC_KVB) const

Definition at line 29 of file feerate.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator* [1/2]

CFeeRate operator* ( const CFeeRate f,
int  a 
)
friend

Definition at line 77 of file feerate.h.

◆ operator* [2/2]

CFeeRate operator* ( int  a,
const CFeeRate f 
)
friend

Definition at line 78 of file feerate.h.

◆ operator<=>

std::weak_ordering operator<=> ( const CFeeRate a,
const CFeeRate b 
)
friend

Definition at line 64 of file feerate.h.

◆ operator==

bool operator== ( const CFeeRate a,
const CFeeRate b 
)
friend

Definition at line 68 of file feerate.h.

Member Data Documentation

◆ m_feerate

FeePerVSize CFeeRate::m_feerate
private

Fee rate in sats/vB (satoshis per N virtualbytes)

Definition at line 38 of file feerate.h.


The documentation for this class was generated from the following files: