/Users/eugenesiegel/btc/bitcoin/src/policy/feerate.cpp
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | // Copyright (c) 2009-2010 Satoshi Nakamoto | 
| 2 |  | // Copyright (c) 2009-present The Bitcoin Core developers | 
| 3 |  | // Distributed under the MIT software license, see the accompanying | 
| 4 |  | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | 
| 5 |  |  | 
| 6 |  | #include <consensus/amount.h> | 
| 7 |  | #include <policy/feerate.h> | 
| 8 |  | #include <tinyformat.h> | 
| 9 |  |  | 
| 10 |  |  | 
| 11 |  | CFeeRate::CFeeRate(const CAmount& nFeePaid, int32_t virtual_bytes) | 
| 12 | 931k | { | 
| 13 | 931k |     if (virtual_bytes > 0) { | 
| 14 | 931k |         m_feerate = FeePerVSize(nFeePaid, virtual_bytes); | 
| 15 | 931k |     } else { | 
| 16 | 0 |         m_feerate = FeePerVSize(); | 
| 17 | 0 |     } | 
| 18 | 931k | } | 
| 19 |  |  | 
| 20 |  | CAmount CFeeRate::GetFee(int32_t virtual_bytes) const | 
| 21 | 3.74M | { | 
| 22 | 3.74M |     Assume(virtual_bytes >= 0); | Line | Count | Source |  | 118 | 3.74M | #define Assume(val) inline_assertion_check<false>(val, __FILE__, __LINE__, __func__, #val) | 
 | 
| 23 | 3.74M |     if (m_feerate.IsEmpty()) { return CAmount(0);}0 | 
| 24 | 3.74M |     CAmount nFee = CAmount(m_feerate.EvaluateFeeUp(virtual_bytes)); | 
| 25 | 3.74M |     if (nFee == 0 && virtual_bytes != 0648k&& m_feerate.fee < 0648k) return CAmount(-1)0; | 
| 26 | 3.74M |     return nFee; | 
| 27 | 3.74M | } | 
| 28 |  |  | 
| 29 |  | std::string CFeeRate::ToString(const FeeEstimateMode& fee_estimate_mode) const | 
| 30 | 290k | { | 
| 31 | 290k |     const CAmount feerate_per_kvb = GetFeePerK(); | 
| 32 | 290k |     switch (fee_estimate_mode) { | 
| 33 | 0 |     case FeeEstimateMode::SAT_VB: return strprintf("%d.%03d %s/vB", feerate_per_kvb / 1000, feerate_per_kvb % 1000, CURRENCY_ATOM);| Line | Count | Source |  | 1172 | 0 | #define strprintf tfm::format | 
 | 
| 34 | 290k |     default:                      return strprintf("%d.%08d %s/kvB", feerate_per_kvb / COIN, feerate_per_kvb % COIN, CURRENCY_UNIT);| Line | Count | Source |  | 1172 | 290k | #define strprintf tfm::format | 
 | 
| 35 | 290k |     } | 
| 36 | 290k | } |