Bitcoin Core  0.21.1
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
Public Member Functions | Private Attributes | Friends | List of all members
CFeeRate Class Reference

Fee rate in satoshis per kilobyte: CAmount / kB. More...

#include <feerate.h>

Public Member Functions

 CFeeRate ()
 Fee rate of 0 satoshis per kB. More...
 
template<typename I >
 CFeeRate (const I _nSatoshisPerK)
 
 CFeeRate (const CAmount &nFeePaid, size_t nBytes)
 Constructor for a fee rate in satoshis per kvB (sat/kvB). More...
 
CAmount GetFee (size_t nBytes) const
 Return the fee in satoshis for the given size in bytes. More...
 
CAmount GetFeePerK () const
 Return the fee in satoshis for a size of 1000 bytes. 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
 

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)
 

Detailed Description

Fee rate in satoshis per kilobyte: CAmount / kB.

Definition at line 29 of file feerate.h.

Constructor & Destructor Documentation

CFeeRate::CFeeRate ( )
inline

Fee rate of 0 satoshis per kB.

Definition at line 36 of file feerate.h.

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

Definition at line 38 of file feerate.h.

CFeeRate::CFeeRate ( const CAmount nFeePaid,
size_t  nBytes 
)

Constructor for a fee rate in satoshis per kvB (sat/kvB).

The size in bytes must not exceed (2^63 - 1).

Passing an nBytes value of COIN (1e8) returns a fee rate in satoshis per vB (sat/vB), e.g. (nFeePaid * 1e8 / 1e3) == (nFeePaid / 1e5), where 1e5 is the ratio to convert from BTC/kvB to sat/vB.

Parameters
[in]nFeePaidCAmount fee rate to construct with
[in]nBytessize_t bytes (units) to construct with
Returns
fee rate

Definition at line 10 of file feerate.cpp.

Member Function Documentation

CAmount CFeeRate::GetFee ( size_t  nBytes) const

Return the fee in satoshis for the given size in bytes.

Definition at line 21 of file feerate.cpp.

Here is the caller graph for this function:

CAmount CFeeRate::GetFeePerK ( ) const
inline

Return the fee in satoshis for a size of 1000 bytes.

Definition at line 60 of file feerate.h.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 67 of file feerate.h.

CFeeRate::SERIALIZE_METHODS ( CFeeRate  ,
obj   
)
inline

Definition at line 70 of file feerate.h.

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

Definition at line 38 of file feerate.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

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

Definition at line 66 of file feerate.h.

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

Definition at line 61 of file feerate.h.

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

Definition at line 64 of file feerate.h.

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

Definition at line 63 of file feerate.h.

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

Definition at line 62 of file feerate.h.

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

Definition at line 65 of file feerate.h.

Member Data Documentation

CAmount CFeeRate::nSatoshisPerK
private

Definition at line 32 of file feerate.h.


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