-
Notifications
You must be signed in to change notification settings - Fork 131
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
Update Psbt APIs #305
Merged
Merged
Update Psbt APIs #305
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
30fa409
Remove local function script_is_v1_p2tr
sanket1729 0c64a70
Add more auto-derives to conversion error
sanket1729 49fe1ca
Introduce PsbtExt trait
sanket1729 5fa86b2
Move input sighash type match checks into sanity_check
sanket1729 68cccb3
Add support for finalize input
sanket1729 daa80b7
Update finalize API to return vector of errors
sanket1729 472f803
Update Psbt APIs with _mut and _input support
sanket1729 e9b53e9
Update psbt finalize_* APIs to consume self
sanket1729 b3f4c18
Correct redeem script/script code caluclation
sanket1729 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 815d012:
I think we should make this function generic over the satisfier type, and expose additional methods in the
PsbtExt
trait that users can use to provide their ownSatisfier
s. (The existing methods would have this linelet sat = PsbtInputSatisfier::new(&psbt, index);
and pass that into this function.)I think this, maybe in conjunction with some extensions to the
Satisfier
trait, would give Jeremy the tools to implement what he's getting at here.Edit: never mind, I was confused about finalizing vs updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i actually think that here, this is OK. Since we're finalizing here, not signing, all the data should already be in here.
What might work is an API that takes a PSBT input as a Processing(PsbtInputRef) and then you can call many
fn try_sat(self, s: dyn Satisfier) -> Processing
and then lastly callProcessing::finalize_input(self) -> Result<Psbt, Error>
or something like that which gives you back your Psbt in the end.This way you could try passing the input in the processing phase to multiple signers, without doing intepreter checks, and then do a final "try to finalize call" which then either succeeds or fails.
One important cleanup: if it does fail, we should make sure the PSBT is not modified at all so that we can retry signing. edit: I guess you can always clone the psbt before you try...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yep, I understand.
Your proposed API is interesting but I think too complicated for this API (and this major rev).