Skip to content

Commit e50a9be

Browse files
committed
Remove outdated comment on CFeeRate
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. In the constructor this could be rectified by creating a CFeeRate from that given value (in BTC/vB) and COIN as the transaction size, turning the input effectively to sat/vB. Since this usage pattern was removed from the codebase some months ago, the comment is now obsolete. Also: • Use vsize and vbyte instead of size and byte
1 parent 5e8e0b3 commit e50a9be

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/policy/feerate.h

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,40 @@ enum class FeeEstimateMode {
2424
};
2525

2626
/**
27-
* Fee rate in satoshis per kilobyte: CAmount / kB
27+
* Fee rate in satoshis per kilovirtualbyte: CAmount / kvB
2828
*/
2929
class CFeeRate
3030
{
3131
private:
32-
CAmount nSatoshisPerK; // unit is satoshis-per-1,000-bytes
32+
/** Fee rate in sat/kvB (satoshis per 1000 virtualbytes) */
33+
CAmount nSatoshisPerK;
3334

3435
public:
35-
/** Fee rate of 0 satoshis per kB */
36+
/** Fee rate of 0 satoshis per kvB */
3637
CFeeRate() : nSatoshisPerK(0) { }
3738
template<typename I>
3839
explicit CFeeRate(const I _nSatoshisPerK): nSatoshisPerK(_nSatoshisPerK) {
3940
// We've previously had bugs creep in from silent double->int conversion...
4041
static_assert(std::is_integral<I>::value, "CFeeRate should be used without floats");
4142
}
42-
/** Constructor for a fee rate in satoshis per kvB (sat/kvB).
43+
44+
/**
45+
* Construct a fee rate from a fee in satoshis and a vsize in vB.
4346
*
44-
* Passing a num_bytes value of COIN (1e8) returns a fee rate in satoshis per vB (sat/vB),
45-
* e.g. (nFeePaid * 1e8 / 1e3) == (nFeePaid / 1e5),
46-
* where 1e5 is the ratio to convert from BTC/kvB to sat/vB.
47+
* param@[in] nFeePaid The fee paid by a transaction, in satoshis
48+
* param@[in] num_bytes The vsize of a transaction, in vbytes
4749
*/
4850
CFeeRate(const CAmount& nFeePaid, uint32_t num_bytes);
51+
4952
/**
50-
* Return the fee in satoshis for the given size in bytes.
51-
* If the calculated fee would have fractional satoshis, then the returned fee will always be rounded up to the nearest satoshi.
53+
* Return the fee in satoshis for the given vsize in vbytes.
54+
* If the calculated fee would have fractional satoshis, then the
55+
* returned fee will always be rounded up to the nearest satoshi.
5256
*/
5357
CAmount GetFee(uint32_t num_bytes) const;
58+
5459
/**
55-
* Return the fee in satoshis for a size of 1000 bytes
60+
* Return the fee in satoshis for a vsize of 1000 vbytes
5661
*/
5762
CAmount GetFeePerK() const { return GetFee(1000); }
5863
friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; }

0 commit comments

Comments
 (0)