-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[psbt] Convert non-witness UTXOs to witness if witness sig created #14197
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
7e52500 to
f03eb81
Compare
src/script/sign.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.
Travis is complaining about whitespace here.
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.
Fixed
f03eb81 to
52d9adc
Compare
|
ACK |
|
utACK 52d9adc. I'll test this soon. |
src/script/sign.cpp
Outdated
| if (sigdata.witness) { | ||
| // Convert the non-witness utxo to witness | ||
| if (input.witness_utxo.IsNull() && input.non_witness_utxo) { | ||
| input.witness_utxo = input.non_witness_utxo->vout[tx.vin[index].prevout.n]; |
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.
IIUC this could be
assert(!utxo.IsNull());
input.witness_utxo = utxo;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.
Indeed. Done.
|
Here is a test that fails before and succeeds after this PR: sipa@ce238f2 |
|
@achow101 Feel free to cherry-pick the test into this PR. That RPC test is a reproduction of what I did to notice the issue in the first place, so Tested ACK from me. |
52d9adc to
51a6a69
Compare
|
I've added @sipa's test |
51a6a69 to
adc6a52
Compare
If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.
adc6a52 to
862d159
Compare
Reviewers, 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. |
|
ACK 862d159 |
promag
left a comment
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 862d159.
|
|
||
| from test_framework.test_framework import BitcoinTestFramework | ||
| from test_framework.util import assert_equal, assert_raises_rpc_error, find_output | ||
| from test_framework.util import assert_equal, assert_raises_rpc_error, find_output, disconnect_nodes, connect_nodes_bi, sync_blocks |
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, nit, nit, sort.
|
|
utACK 862d159 |
…sig created 862d159 Add test for conversion from non-witness to witness UTXO (Pieter Wuille) f8c1714 Convert non-witness UTXOs to witness if witness sig created (Andrew Chow) Pull request description: If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one. Port of #14196 to master. Tree-SHA512: 2235eeb008ffa48e821628032d689e4a83bff6c29b93fa050ab2ee492b0e67b3a30f29a680d4a0e574e05c3a2f9edf0005e161fbe25b7aef2acd034a2424e2f2
Github-Pull: bitcoin#14197 Rebased-From: 862d159
7bee414 Add test for conversion from non-witness to witness UTXO (Pieter Wuille) ff56bb9 Add regression test for PSBT signing bug #14473 (Glenn Willen) db445d4 Refactor PSBTInput signing to enforce invariant (Glenn Willen) ad94165 Simplify arguments to SignPSBTInput (Glenn Willen) 39ece4f Add bool PSBTInputSigned (Glenn Willen) 70ee1f8 New PartiallySignedTransaction constructor from CTransction (Glenn Willen) a9eab08 Remove redundant txConst parameter to FillPSBT (Glenn Willen) cfdd6b2 More concise conversion of CDataStream to string (Glenn Willen) a3fe125 check that a separator is found for psbt inputs, outputs, and global map (Andrew Chow) Pull request description: This is a backport of #14588, #14377, and #14197's test to 0.17. Tree-SHA512: 07535ec69a878a63b549e5e463345e233f34662dff805202614cf2ffc896c6d1981363e6d06d02db2e02d815075ad8ebdc5f93f637052cff8c8cbe6c8dfa096a
If a witness signature was created when a non-witness UTXO is used, convert the non-witness UTXO to a witness one.
Port of #14196 to master.