Is there an existing issue for this?
- I have searched the existing issues
Current behaviour
I am not a C++ programmer. This code looks like it has 4 lines that do nothing.
In commit: 0fbaef9676a a call to std::ceil was added which makes the following if statement do nothing. There is no harm done but it makes the code confusing for non-c++ devs to read.
CAmount CFeeRate::GetFee(uint32_t num_bytes) const
{
const int64_t nSize{num_bytes};
// Be explicit that we're converting from a double to int64_t (CAmount) here.
// We've previously had issues with the silent double->int64_t conversion.
CAmount nFee{static_cast<CAmount>(std::ceil(nSatoshisPerK * nSize / 1000.0))};
if (nFee == 0 && nSize != 0) {
if (nSatoshisPerK > 0) nFee = CAmount(1);
if (nSatoshisPerK < 0) nFee = CAmount(-1);
}
return nFee;
}
Expected behaviour
There is no behaviour issue with the current code.