-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Additional utility RPCs for PSBT #13932
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
|
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. |
It doesn't look in the wallet? |
|
@gmaxwell |
66bf5c1 to
ff443cf
Compare
|
Rebased |
|
Rebased |
eeafff2 to
f29d03c
Compare
src/rpc/rawtransaction.cpp
Outdated
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 reduce indentation?
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.
Done
src/rpc/rawtransaction.cpp
Outdated
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 be more informative?
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.
What else could be said?
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.
Like the conflicting input index?
src/rpc/rawtransaction.cpp
Outdated
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.
Should allow duplicate outputs? Or should sum values into one output?
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.
Duplicate outputs should be allowed. The idea is that there are two distinct transactions with separate inputs and outputs. They are just being combined into one transaction. Thus you can have duplicate outputs as outputs are still unique. However the inputs must be enforced to be unique.
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.
@achow101 could you ack/nack on #12419, esp @meshcollider #12419 (comment)
src/rpc/rawtransaction.cpp
Outdated
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.
So this is necessary because the first is a copy and the remaining psbt inputs are cleared because of AddInput. Maybe remove this "optimization" and merge all psbts to an empty psbt?
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 don't see how that is better.
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.
It would be less code, and less complexity, which I would say is always better, absent a reason to write more code. Why write more code?
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.
(Also, this is copied from combinepsbt, where it is easiest to treat the first tx specially, because we need something to compare all the others to, to make sure the underlying transaction is the same. That restriction doesn't exist here, so the need for the extra step is gone.)
src/rpc/rawtransaction.cpp
Outdated
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.
Should force txs.size() > 1?
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.
Done
src/rpc/rawtransaction.cpp
Outdated
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.
The scope of size could be reduced?
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.
Done
f29d03c to
9004ce4
Compare
|
Rebased |
|
|
||
| from test_framework.test_framework import BitcoinTestFramework | ||
| from test_framework.util import assert_equal, assert_raises_rpc_error, find_output | ||
| from decimal import Decimal |
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.
Nit: Sort imports :-)
Adds a joinpsbts RPC which combines multiple distinct PSBTs into one PSBT.
When signing an input, figure out what was requested for but was unable to be found and store it in a SignatureData. Return this information in SignPSBTInput.
310b395 to
43bbc2c
Compare
43bbc2c to
540729e
Compare
|
re-utACK 540729e |
540729e Implement analyzepsbt RPC and tests (Andrew Chow) 77542cf Move PSBT UTXO fetching to a separate method (Andrew Chow) cb40b3a Figure out what is missing during signing (Andrew Chow) 08f749c Implement joinpsbts RPC and tests (Andrew Chow) 7344a7b Implement utxoupdatepsbt RPC and tests (Andrew Chow) Pull request description: This PR adds 3 new utility RPCs for interacting with PSBTs. `utxoupdatepsbt` updates a PSBT with UTXO information from the node. It only works with witness UTXOs because full transactions (as would be needed for non-witness UTXOs) are not available unless txindex is enabled. `joinpsbts` joins the inputs from multiple distinct PSBTs into one PSBT. e.g. if PSBT 1 has inputs 1 and 2, and PSBT 2 has inputs 3 and 4, `joinpsbts` would create a new PSBT with inputs 1, 2, 3, and 4. `analyzepsbt` analyzes a PSBT and determines the current state of it and all of its inputs, and the next step that needs to be done. Tree-SHA512: 3c1fa302201abca76a8901d0c2be7b4ccbce334d989533c215f8b3e50e22f2f018ce6209544b26789f58f5980a253c0655111e1e20d47d5656e0414c64891a5c
Summary: bitcoin/bitcoin@7344a7b --- This is a partial backport of Core [[bitcoin/bitcoin#13932 | PR13932]] Test Plan: ninja check test_runner.py rpc_psbt Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6043
Summary: Adds a joinpsbts RPC which combines multiple distinct PSBTs into one PSBT. bitcoin/bitcoin@08f749c --- Depends on D6043 This is a partial backport of Core [[bitcoin/bitcoin#13932 | PR13932]] plus a test case Test Plan: ninja check test_runner.py rpc_psbt Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6044
Summary: bitcoin/bitcoin@77542cf --- Depends on D6044 This is a partial backport of Core [[bitcoin/bitcoin#13932 | PR13932]] Test Plan: unfortunately no tests are included with this commit Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6045
Summary: When signing an input, figure out what was requested for but was unable to be found and store it in a SignatureData. Return this information in SignPSBTInput. bitcoin/bitcoin@cb40b3a --- Depends on D6045 This is a partial backport of Core [[bitcoin/bitcoin#13932 | PR13932]] Test Plan: ninja check check-functional Reviewers: #bitcoin_abc, deadalnix, nakihito Reviewed By: #bitcoin_abc, deadalnix, nakihito Subscribers: nakihito, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6046
Summary: bitcoin/bitcoin@540729e --- This completes the backport of Core [[bitcoin/bitcoin#13932 | PR13932]] Test Plan: cmake .. -GNinja -DENABLE_WERROR=ON ninja check-all Reviewers: #bitcoin_abc, nakihito, deadalnix Reviewed By: #bitcoin_abc, nakihito, deadalnix Subscribers: nakihito Differential Revision: https://reviews.bitcoinabc.org/D6058
merge bitcoin#16117, bitcoin#18358, bitcoin#17383, bitcoin#21052, bitcoin#14424, bitcoin#15159, bitcoin#14689, bitcoin#14978, partial bitcoin#16908, bitcoin#14978, bitcoin#13932: Auxillary Backports
This PR adds 3 new utility RPCs for interacting with PSBTs.
utxoupdatepsbtupdates a PSBT with UTXO information from the node. It only works with witness UTXOs because full transactions (as would be needed for non-witness UTXOs) are not available unless txindex is enabled.joinpsbtsjoins the inputs from multiple distinct PSBTs into one PSBT. e.g. if PSBT 1 has inputs 1 and 2, and PSBT 2 has inputs 3 and 4,joinpsbtswould create a new PSBT with inputs 1, 2, 3, and 4.analyzepsbtanalyzes a PSBT and determines the current state of it and all of its inputs, and the next step that needs to be done.