-
Notifications
You must be signed in to change notification settings - Fork 108
Consider Output Address Types #51
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
Comments
So yes, your estimate would be 10 bytes off if your change output was a P2WSH script. Worst case scenario is around 5% (if your tx is as small as possible) I'm open to suggestions on how to handle this. |
Thanks for the info. I am building a multisig wallet that uses P2WSH and I see two possible solutions:
I have looked over the code and I could make a pr doing either of these solutions. Thanks again for all the help. |
I would say both.
I would also perhaps add a flag for low R, default false, that if true will shave one byte off each signature estimate (the R value being low) Bitcoin Core now uses low R and BitcoinJS ECPair and bip32 objects support low R (default is off though). |
I think I might be to add a changeBytes() with a similar footprint to outputBytes(), but with a P2WSH default size. I would also add a changeThreshold() similar to dustThreshold() and use it in finalize instead of dustThreshold(). In order for changeBytes() to have the output.script parameter, I was considering adding an optional changeScript parameter to coinselect(). As for the r low flag, I am unsure how best to add that since it seems to concern other parts of the library. |
This PR seems to address the bulk of these issues. I will try and get a grasp on that pr and help out. |
How does coinselect(utxos, targets, feeRate) get a correct transaction size when coinselect does not know what type of change address will be used? The change address could be a really large script that could push the fee rate below the required fee rate or make change not worth keeping. Great library and thanks so much for helping me clarify my understandings.
The text was updated successfully, but these errors were encountered: