| 21 | } |
| 22 | |
| 23 | CAmount CFeeRate::GetFee(uint32_t num_bytes) const |
| 24 | { |
| 25 | const int64_t nSize{num_bytes}; |
| 26 | |
| 27 | // Be explicit that we're converting from a double to int64_t (CAmount) here. |
| 28 | // We've previously had issues with the silent double->int64_t conversion. |
| 29 | CAmount nFee{static_cast<CAmount>(std::ceil(nSatoshisPerK * nSize / 1000.0))}; |
| 30 | |
| 31 | if (nFee == 0 && nSize != 0) { |
| 32 | if (nSatoshisPerK > 0) nFee = CAmount(1); |
| 33 | if (nSatoshisPerK < 0) nFee = CAmount(-1); |
| 34 | } |
| 35 | |
| 36 | return nFee; |
| 37 | } |
| 38 | |
| 39 | std::string CFeeRate::ToString(const FeeEstimateMode& fee_estimate_mode) const |
| 40 | { |
no outgoing calls