Skip to content

Commit 3404c1b

Browse files
committed
policy: optional FeeEstimateMode param to CFeeRate::ToString
1 parent 6fcf448 commit 3404c1b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/policy/feerate.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ CAmount CFeeRate::GetFee(size_t nBytes_) const
3535
return nFee;
3636
}
3737

38-
std::string CFeeRate::ToString() const
38+
std::string CFeeRate::ToString(const FeeEstimateMode& fee_estimate_mode) const
3939
{
40-
return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
40+
switch (fee_estimate_mode) {
41+
case FeeEstimateMode::SAT_B: return strprintf("%d.%03d %s/B", nSatoshisPerK / 1000, nSatoshisPerK % 1000, CURRENCY_ATOM);
42+
default: return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
43+
}
4144
}

src/policy/feerate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class CFeeRate
5656
friend bool operator>=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK >= b.nSatoshisPerK; }
5757
friend bool operator!=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK != b.nSatoshisPerK; }
5858
CFeeRate& operator+=(const CFeeRate& a) { nSatoshisPerK += a.nSatoshisPerK; return *this; }
59-
std::string ToString() const;
59+
std::string ToString(const FeeEstimateMode& fee_estimate_mode = FeeEstimateMode::BTC_KB) const;
6060

6161
SERIALIZE_METHODS(CFeeRate, obj) { READWRITE(obj.nSatoshisPerK); }
6262
};

0 commit comments

Comments
 (0)