libsv / go-bt

The go-to Bitcoin Transaction (BT) Go library.
https://pkg.go.dev/mod/github.com/libsv/go-bt
ISC License
66 stars 26 forks source link

Fix for change and tiny fee calculations #112

Closed theflyingcodr closed 2 years ago

theflyingcodr commented 2 years ago

With the change to tiny dust limits and 0.05 sat / byte tx fee rates some of the rounding needed re-visited as off by one bugs were noticed when calculating change.

This has been remedied by using floating point as much as possible and using an int conversion as late as possible to ensure accurate figures.

This has resulted in some tests that had questionable results now becoming more accurate also.

codecov-commenter commented 2 years ago

Codecov Report

Merging #112 (f13149f) into master (0d68685) will decrease coverage by 0.01%. The diff coverage is 88.00%.

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
- Coverage   83.84%   83.82%   -0.02%     
==========================================
  Files          34       34              
  Lines        3676     3672       -4     
==========================================
- Hits         3082     3078       -4     
  Misses        427      427              
  Partials      167      167              
Impacted Files Coverage Δ
txchange.go 80.76% <85.00%> (-1.99%) :arrow_down:
tx.go 78.68% <100.00%> (+0.17%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0d68685...f13149f. Read the comment docs.