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

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

#include <feerate.h>

Collaboration diagram for CFeeRate:
[legend]

Public Member Functions

 CFeeRate ()=delete
 
 CFeeRate (const Amount m_feerate_kvb)
 
 CFeeRate (const Amount nFeePaid, int32_t virtual_bytes)
 Construct a fee rate from a fee in satoshis and a size in B. More...
 
Amount GetFee (int32_t virtual_bytes) const
 Return the fee in satoshis for the given size in bytes. More...
 
Amount GetFeePerK () const
 Return the fee in satoshis for a size of 1000 bytes. More...
 
CFeeRate & operator+= (const CFeeRate &a)
 
std::string ToString () const
 
 SERIALIZE_METHODS (CFeeRate, obj)
 

Private Attributes

FeePerVSize m_feerate
 

Friends

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

Detailed Description

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

Definition at line 24 of file feerate.h.

Constructor & Destructor Documentation

◆ CFeeRate() [1/3]

CFeeRate::CFeeRate ( )
delete

◆ CFeeRate() [2/3]

CFeeRate::CFeeRate ( const Amount  m_feerate_kvb)
inlineexplicit

Definition at line 31 of file feerate.h.

◆ CFeeRate() [3/3]

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

Construct a fee rate from a fee in satoshis and a size in B.

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

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

Definition at line 15 of file feerate.cpp.

Member Function Documentation

◆ GetFee()

Amount CFeeRate::GetFee ( int32_t  virtual_bytes) const

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

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 call graph for this function:
Here is the caller graph for this function:

◆ GetFeePerK()

Amount CFeeRate::GetFeePerK ( ) const
inline

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

Definition at line 55 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 67 of file feerate.h.

Here is the call graph for this function:

◆ SERIALIZE_METHODS()

CFeeRate::SERIALIZE_METHODS ( CFeeRate  ,
obj   
)
inline

Definition at line 75 of file feerate.h.

◆ ToString()

std::string CFeeRate::ToString ( ) const

Definition at line 43 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<=>

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

Definition at line 59 of file feerate.h.

◆ operator==

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

Definition at line 63 of file feerate.h.

Member Data Documentation

◆ m_feerate

FeePerVSize CFeeRate::m_feerate
private

Definition at line 27 of file feerate.h.


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