Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/tx fees #42

Merged
merged 10 commits into from
Sep 6, 2021
Merged

Feat/tx fees #42

merged 10 commits into from
Sep 6, 2021

Conversation

theflyingcodr
Copy link
Contributor

@theflyingcodr theflyingcodr commented Sep 2, 2021

This refactors the fee calculations to improve accuracy and also provide a breakdown of the fees paid and the breakdown of the tx bytes.

This also includes some improvements to change calcs, change will now not be added if it will be below the dust limit after covering outputs and tx fees.

New methods added to the tx:

 isEnough, err := tx.IsFeePaidEnough(feeQuote) // are current fees being paid by tx enough to meet given feeQuote?
 txFees, err := tx.EstimateFeesPaid(feeQuote) // fees required to be paid by tx
 size := tx.Size() / / current tx size (int) with nothing added
 txSize := tx.SizeWithTypes() / / current tx size (including types) with nothing added
 size, err := tx.EstimateSize() // add 107 bytes for any unsigned inputs
 txSize, err := tx.EstimateSizeWithTypes() // add 107 bytes for any unsigned inputs (including types)

@theflyingcodr theflyingcodr self-assigned this Sep 2, 2021
@mergify mergify bot added the feature label Sep 2, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2021

Codecov Report

Merging #42 (bd71290) into master (b8ebe83) will decrease coverage by 0.20%.
The diff coverage is 73.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #42      +/-   ##
==========================================
- Coverage   86.31%   86.10%   -0.21%     
==========================================
  Files          26       26              
  Lines        2762     2800      +38     
==========================================
+ Hits         2384     2411      +27     
- Misses        260      268       +8     
- Partials      118      121       +3     
Impacted Files Coverage Δ
tx.go 79.67% <68.51%> (-4.54%) ⬇️
txchange.go 82.75% <84.61%> (+4.38%) ⬆️

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 b8ebe83...bd71290. Read the comment docs.

…rry about the size bool, instead they can call SizeUnsigned and Size
@theflyingcodr theflyingcodr added work-in-progress If set, indicates the current PR is not ready for merging. Mergify will not auto merge and removed work-in-progress If set, indicates the current PR is not ready for merging. Mergify will not auto merge labels Sep 2, 2021
@mergify mergify bot merged commit 8545c23 into master Sep 6, 2021
@mergify mergify bot deleted the feat/tx_fees branch September 6, 2021 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants