Review report

bitcoin/bitcoin: PR #36741

1 suggestion

Optional improvements

Link

[suggestion] · Getter comments leave signed rounding directions implicit

The comments use correct ceiling/floor terminology, but spelling out the infinity directions would make the negative-feerate behavior clearer.

Location: src/policy/feerate.h:59 (head).

Details and suggested fix

For negative feerates, GetFee rounds towards zero while GetFeePerK rounds away from zero. For example, CFeeRate(-123).GetFee(8) now returns 0 instead of the removed special case's -1, and CFeeRate(-1, 3).GetFeePerK() returns -334 rather than a truncated -333. Use “Rounds towards positive infinity” for GetFee and “Rounds towards negative infinity” for GetFeePerK, matching FeeFrac::EvaluateFee and avoiding confusion with rounding the magnitude or truncating. The added assertions already demonstrate these examples, so this is a public-documentation clarification only. No current production caller passing a negative feerate to GetFee was found.


Coverage details