Skip to content

Commit 3904bf5

Browse files
author
Jan
authored
Update feerate.cpp
1 parent bb186ef commit 3904bf5

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/policy/feerate.cpp

+9-11
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,26 @@
1111

1212
CFeeRate::CFeeRate(const CAmount& nFeePaid, uint32_t num_bytes)
1313
{
14-
assert(num_bytes <= uint64_t(std::numeric_limits<int64_t>::max()));
15-
int64_t nSize = int64_t(num_bytes);
14+
const int64_t nSize{num_bytes};
15+
1616
if (nSize > 0) {
1717
nSatoshisPerK = nFeePaid * 1000 / nSize;
1818
} else {
1919
nSatoshisPerK = 0;
20-
}
20+
}
2121
}
2222

2323
CAmount CFeeRate::GetFee(uint32_t num_bytes) const
2424
{
25-
assert(num_bytes <= uint64_t(std::numeric_limits<int64_t>::max()));
26-
int64_t nSize = int64_t(num_bytes);
25+
const int64_t nSize{num_bytes};
26+
2727
CAmount nFee{static_cast<CAmount>(std::ceil(nSatoshisPerK * nSize / 1000.0))};
28+
2829
if (nFee == 0 && nSize != 0) {
29-
if (nSatoshisPerK > 0) {
30-
nFee = CAmount(1);
31-
}
32-
if (nSatoshisPerK < 0) {
33-
nFee = CAmount(-1);
34-
}
30+
if (nSatoshisPerK > 0) nFee = CAmount(1);
31+
if (nSatoshisPerK < 0) nFee = CAmount(-1);
3532
}
33+
3634
return nFee;
3735
}
3836

0 commit comments

Comments
 (0)