-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Version bump] Fix fee calculation when funding a psbt. #7404
base: master
Are you sure you want to change the base?
[Version bump] Fix fee calculation when funding a psbt. #7404
Conversation
37cfb26
to
4d43a61
Compare
I've tested (especially with the example provided in #5739) and it worked like a charm 👍 The only thing I don't understand is your 112 in your example (shouldn't be 110?) EDIT: didn't see that it's a 1-1 p2tr so should be 111 |
4d43a61
to
90594db
Compare
Just to clarify why 112 and not 111. I think studying this let me to a bug in the size calculation. Basically we account for 2 additional weight-units, one here size of witness elements this shouldn't be here because every Witness Input already accounts for its number of elements: number of items. But only this one would also lead to 112. Moreover we account for an additional sighhash byte in the P2TR Weight, this I find not necessary because it was left out exactly to save weight but also fees (IMO). additional sighash wu Thos 2 additonal weight units lead to 1vbyte more according to estimate I think we should also fix this too, what are your opinions ? |
This commit tests the new input selection logic and therefore fixing the fee calculation for specific input/output combinations.
90594db
to
65f079f
Compare
I think this estimate of 66 wu for a P2TR input is correct, because The P2TR input would only be 65 wu when using |
Change Description
This PR tests the changes made in btcsuite/btcwallet#844 to make sure the lnd test suite passes.
The new versions of the btcwallet and the txauthor fix #5739
How to test the new funding for example on simnet (now we get an error when the available amount is too low which lets us construct a transaction which creates no change output:
Available funding is 9466 - 112 (fee without a change output using the required feerate) = 9354 sathoshis
The resulting tx pays exactly 112 sats, and is off by 1 sat (virtualsize is 111) because we always account for the sighash byte in the taproot spend although the default has none. But I think 1 sat off is not that bad :)