Merge bitcoin/bitcoin#24305: Docs: [policy] Remove outdated confusing comment

e50a9be1540c769a99fcdc1f7a109a6bf1c7516b Remove outdated comment on CFeeRate (Murch)

Pull request description:

  This comment described how the constructor of CFeeRate was previously indirectly used to parse fee rate arguments from RPCs. The command line input was actually in sat/vB but due to the use of AmountFromValue() it got converted to BTC/vB which then got rectified in the constructor by creating a CFeeRate from that given value and COIN as the transaction size. Since this usage pattern was removed from the codebase some months ago, the comment is now obsolete.

ACKs for top commit:
  michaelfolkson:
    ACK e50a9be1540c769a99fcdc1f7a109a6bf1c7516b
  jonatack:
    ACK e50a9be1540c769a99fcdc1f7a109a6bf1c7516b

Tree-SHA512: f17bf0baeeca85a5c7883edadd407da845f6e3af1c949e93116bd67c02e601682a5f7f1ab2497172472e3acf1c4e3c234b01161a77e7d7f028e3551da34777f0
This commit is contained in:
MarcoFalke 2022-02-22 11:19:32 +01:00 committed by Vijay
parent d0e0381dfa
commit e738513a2c
No known key found for this signature in database
GPG Key ID: E38DD2EE8F0967B1

View File

@ -24,34 +24,38 @@ enum class FeeEstimateMode {
}; };
/** /**
* Fee rate in satoshis per kilobyte: CAmount / kB * Fee rate in satoshis per kilovirtualbyte: CAmount / kvB
*/ */
class CFeeRate class CFeeRate
{ {
private: private:
CAmount nSatoshisPerK; // unit is satoshis-per-1,000-bytes /** Fee rate in sat/kvB (satoshis per 1000 virtualbytes) */
CAmount nSatoshisPerK;
public: public:
/** Fee rate of 0 satoshis per kB */ /** Fee rate of 0 satoshis per kvB */
CFeeRate() : nSatoshisPerK(0) { } CFeeRate() : nSatoshisPerK(0) { }
template<typename I> template<typename I>
explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) { explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) {
// We've previously had bugs creep in from silent double->int conversion... // We've previously had bugs creep in from silent double->int conversion...
static_assert(std::is_integral<I>::value, "CFeeRate should be used without floats"); static_assert(std::is_integral<I>::value, "CFeeRate should be used without floats");
} }
/** Constructor for a fee rate in satoshis per kB (duff/kB).
/**
* Construct a fee rate from a fee in satoshis and a vsize in vB.
* *
* Passing a num_bytes value of COIN (1e8) returns a fee rate in satoshis per B (sat/B), * param@[in] nFeePaid The fee paid by a transaction, in satoshis
* e.g. (nFeePaid * 1e8 / 1e3) == (nFeePaid / 1e5), * param@[in] num_bytes The vsize of a transaction, in vbytes.
* where 1e5 is the ratio to convert from DASH/kB to sat/B.
*/ */
CFeeRate(const CAmount& nFeePaid, uint32_t num_bytes); CFeeRate(const CAmount& nFeePaid, uint32_t num_bytes);
/** /**
* Return the fee in satoshis for the given size in bytes. * Return the fee in satoshis for the given size in vbytes.
*/ */
CAmount GetFee(uint32_t num_bytes) const; CAmount GetFee(uint32_t num_bytes) const;
/** /**
* Return the fee in satoshis for a size of 1000 bytes * Return the fee in satoshis for a vsize of 1000 vbytes
*/ */
CAmount GetFeePerK() const { return nSatoshisPerK; } CAmount GetFeePerK() const { return nSatoshisPerK; }
friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; } friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; }