aboutsummaryrefslogtreecommitdiff
path: root/depends
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2021-10-08 13:57:48 -0400
committerfanquake <fanquake@gmail.com>2022-02-15 09:22:06 +0000
commitc768bfa08af034c744402d4294cc323d653b97b8 (patch)
tree835d2376b673f10f78ab8c12a9297774424a0810 /depends
parentf66bc42957ad2e86982c8c487f821683d3009b43 (diff)
downloadbitcoin-c768bfa08af034c744402d4294cc323d653b97b8.tar.xz
tests: Calculate fees more similarly to CFeeRate::GetFee
Because of floating point precision issues, not all of the rounding done is always correct. To fix this, the fee calculation for assert_fee_amount is changed to better reflect how CFeeRate::GetFee does it. First the feerate is converted to an int representing sat/kvb. Then this is multiplied by the transaction size, divivided by 1000, and rounded up to the nearest sat. The result is then converted back to BTC (divided by 1e8) and then rounded down to the nearest sat to avoid precision errors. Github-Pull: #22949 Rebased-From: 80dc829be7f8c3914074b85bb4c125baba18cb2c
Diffstat (limited to 'depends')
0 files changed, 0 insertions, 0 deletions