-
Notifications
You must be signed in to change notification settings - Fork 37.7k
rpc: Allow walletprocesspsbt to sign without finalizing #22513
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
Conversation
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.
ACK 81a8c35
Here is a small test exercising the new logic: darosior@cef8042
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
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.
Concept ACK
ae935a7
to
081de78
Compare
I'm not entirely sure whether it's better to use an options object here instead of the conventional interface with named parameters? The latter is easier to use from |
I wonder if there is some syntactic sugar thing we can add that allows us to not have to write JSON manually. |
If by syntactic sugar you mean a client-only change, then I think a better approach, given that we already have a syntax for positional arguments, and we already have a syntax for named arguments, is to just allow these existing syntaxes to be used together. #19762 is a client+server change which does this. And it benefits not just A third approach which Luke at one point liked and perhaps still likes is a server-only change which translates named parameters into options values: #11441 (IIRC similar behavior was also part of #11660). |
081de78
to
7f9310d
Compare
I've dropped the change to use the options object since it is orthogonal to the purpose of this PR. It seems like that will need more discussion too. I've opened issue #22575 for the discussion of what to do about RPCs with lots of positional arguments. |
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.
re-ACK 7f9310d
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.
NACK with positional bool parameter. We shouldn't make the API worse than it already is.
We don't always want to finalize after signing, so make it possible to do that.
7f9310d
to
a99ed89
Compare
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.
utACK a99ed89
signed_tx = self.nodes[0].walletprocesspsbt(psbtx)['psbt'] | ||
signed_tx = self.nodes[0].walletprocesspsbt(psbt=psbtx, finalize=False)['psbt'] | ||
finalized_tx = self.nodes[0].walletprocesspsbt(psbt=psbtx, finalize=True)['psbt'] | ||
assert signed_tx != finalized_tx |
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.
Could also assert ['complete']
is not true before finalizing but is true afterwards
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 that case the result documentation for complete
should also be clarified: "If the transaction has a complete set of signatures and its inputs are finalized"
We don't always want to finalize after signing, so make it possible to do that. Github-Pull: bitcoin#22513 Rebased-From: a99ed89
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.
utACK a99ed89
signed_tx = self.nodes[0].walletprocesspsbt(psbtx)['psbt'] | ||
signed_tx = self.nodes[0].walletprocesspsbt(psbt=psbtx, finalize=False)['psbt'] | ||
finalized_tx = self.nodes[0].walletprocesspsbt(psbt=psbtx, finalize=True)['psbt'] | ||
assert signed_tx != finalized_tx |
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 that case the result documentation for complete
should also be clarified: "If the transaction has a complete set of signatures and its inputs are finalized"
…alizing a99ed89 psbt: sign without finalizing (Andrew Chow) Pull request description: It can be useful to sign an input with `walletprocesspsbt` but not finalize that input if it is complete. This PR adds another option to `walletprocesspsbt` to be able to do that. We will still finalize by default. This does not materially change the PSBT workflow since `finalizepsbt` needs to be called in order to extract the tx for broadcast. ACKs for top commit: meshcollider: utACK a99ed89 Sjors: utACK a99ed89 Tree-SHA512: c88e5d3222109c5f4e763b1b9d97ce4655f68f2985a4509caab2d4e7f5bac5047328fd69696e82a330f5c5a333e0312568ae293515689b77a4747ca2f17caca6
…hout finalizing 46e07e2 psbt: sign without finalizing (Andrew Chow) Pull request description: It can be useful to sign an input with `walletprocesspsbt` but not finalize that input if it is complete. This PR adds another option to `walletprocesspsbt` to be able to do that. We will still finalize by default. This does not materially change the PSBT workflow since `finalizepsbt` needs to be called in order to extract the tx for broadcast. ACKs for top commit: meshcollider: utACK 46e07e2 Sjors: utACK 46e07e2 Tree-SHA512: c88e5d3222109c5f4e763b1b9d97ce4655f68f2985a4509caab2d4e7f5bac5047328fd69696e82a330f5c5a333e0312568ae293515689b77a4747ca2f17caca6
It can be useful to sign an input with
walletprocesspsbt
but not finalize that input if it is complete. This PR adds another option towalletprocesspsbt
to be able to do that. We will still finalize by default.This does not materially change the PSBT workflow since
finalizepsbt
needs to be called in order to extract the tx for broadcast.