Review report

bitcoin/bitcoin: PR #36741

1 suggestion

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Negative GetFeePerK floor rounding lacks unit coverage

The existing positive fractional functional check cannot distinguish floor from truncation for negative rates, leaving that part of GetFeePerK's documented contract without a unit regression check.

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

Details and suggested fix

GetFeePerK() correctly uses EvaluateFeeDown(1000), but GetFeeTest directly asserts its result only for empty rates, and the negative ToStringTest cases all have integral sat/kvB values. The fractional-rate assertion in rpc_psbt.py checks a positive value, where floor and truncation toward zero agree. Add assertions in GetFeeTest that CFeeRate(CAmount{1}, 3).GetFeePerK() returns 333 and CFeeRate(CAmount{-1}, 3).GetFeePerK() returns -334. The negative case would detect a change to truncation returning -333 and pin the rounding contract documented here.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.