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

Fee rate in satoshis per kilovirtualbyte: CAmount / kvB. More...

#include <feerate.h>

Public Member Functions

 CFeeRate ()
 Fee rate of 0 satoshis per kvB. More...
 
template<typename I >
 CFeeRate (const I _nSatoshisPerK)
 
 CFeeRate (const CAmount &nFeePaid, uint32_t num_bytes)
 Construct a fee rate from a fee in satoshis and a vsize in vB. More...
 
CAmount GetFee (uint32_t num_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

CAmount nSatoshisPerK
 Fee rate in sat/kvB (satoshis per 1000 virtualbytes) More...
 

Friends

bool operator< (const CFeeRate &a, const CFeeRate &b)
 
bool operator> (const CFeeRate &a, const CFeeRate &b)
 
bool operator== (const CFeeRate &a, const CFeeRate &b)
 
bool operator<= (const CFeeRate &a, const CFeeRate &b)
 
bool operator>= (const CFeeRate &a, const CFeeRate &b)
 
bool operator!= (const CFeeRate &a, const CFeeRate &b)
 
CFeeRate operator* (const CFeeRate &f, int a)
 
CFeeRate operator* (int a, const CFeeRate &f)
 

Detailed Description

Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.

Definition at line 32 of file feerate.h.

Constructor & Destructor Documentation

◆ CFeeRate() [1/3]

CFeeRate::CFeeRate ( )
inline

Fee rate of 0 satoshis per kvB.

Definition at line 40 of file feerate.h.

◆ CFeeRate() [2/3]

template<typename I >
CFeeRate::CFeeRate ( const I  _nSatoshisPerK)
inlineexplicit

Definition at line 42 of file feerate.h.

◆ CFeeRate() [3/3]

CFeeRate::CFeeRate ( const CAmount nFeePaid,
uint32_t  num_bytes 
)

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

param@[in] nFeePaid The fee paid by a transaction, in satoshis param@[in] num_bytes The vsize of a transaction, in vbytes

Definition at line 12 of file feerate.cpp.

Member Function Documentation

◆ GetFee()

CAmount CFeeRate::GetFee ( uint32_t  num_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 23 of file feerate.cpp.

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 65 of file feerate.h.

Here is the caller graph for this function:

◆ operator+=()

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

Definition at line 72 of file feerate.h.

◆ SERIALIZE_METHODS()

CFeeRate::SERIALIZE_METHODS ( CFeeRate  ,
obj   
)
inline

Definition at line 77 of file feerate.h.

◆ ToString()

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

Definition at line 39 of file feerate.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator!=

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

Definition at line 71 of file feerate.h.

◆ operator* [1/2]

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

Definition at line 74 of file feerate.h.

◆ operator* [2/2]

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

Definition at line 75 of file feerate.h.

◆ operator<

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

Definition at line 66 of file feerate.h.

◆ operator<=

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

Definition at line 69 of file feerate.h.

◆ operator==

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

Definition at line 68 of file feerate.h.

◆ operator>

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

Definition at line 67 of file feerate.h.

◆ operator>=

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

Definition at line 70 of file feerate.h.

Member Data Documentation

◆ nSatoshisPerK

CAmount CFeeRate::nSatoshisPerK
private

Fee rate in sat/kvB (satoshis per 1000 virtualbytes)

Definition at line 36 of file feerate.h.


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