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.
0CAmount CFeeRate::GetFee(uint32_t num_bytes) const
1{
2 const int64_t nSize{num_bytes};
3
4 // Be explicit that we're converting from a double to int64_t (CAmount) here.
5 // We've previously had issues with the silent double->int64_t conversion.
6 CAmount nFee{static_cast<CAmount>(std::ceil(nSatoshisPerK * nSize / 1000.0))};
7
8 if (nFee == 0 && nSize != 0) {
9 if (nSatoshisPerK > 0) nFee = CAmount(1);
10 if (nSatoshisPerK < 0) nFee = CAmount(-1);
11 }
12
13 return nFee;
14}
Expected behaviour
There is no behaviour issue with the current code.