diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-10-08 13:57:48 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2021-10-11 12:29:33 -0400 |
commit | 80dc829be7f8c3914074b85bb4c125baba18cb2c (patch) | |
tree | 3dd75a541a3bb5445f79b160f20fb9b98df3f604 /build_msvc/libsecp256k1_config.h | |
parent | ce2cc44afd51f3df4ee7f14ea05b8da229183923 (diff) |
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.
Diffstat (limited to 'build_msvc/libsecp256k1_config.h')
0 files changed, 0 insertions, 0 deletions