-
Notifications
You must be signed in to change notification settings - Fork 38.8k
rpc: Correctly compute redeemScript from witnessScript for signrawtransaction #18484
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
|
utACK c0f9a61793ffccb6af97ffb6b4a156780e1a4597 After this it seems that |
c0f9a61 to
d0deb17
Compare
ParsePrevouts uses GetScriptForWitness on the given witnessScript to find the corresponding redeemScript. This is incorrect when the witnessScript is either a P2PK or P2PKH script as it returns the corresponding P2WPK script instead of turning the witnessScript into a P2WSH script. Instead this should make the script a WitnessV0ScriptHash destination and get the script for that. Test cases are also added.
d0deb17 to
cd3b156
Compare
|
weak ACK cd3b156, only checked that the test fails without the code change 🚰 Show signature and timestampSignature: Timestamp of file with hash |
|
Appveyor failure in signrawtransaction: https://ci.appveyor.com/project/DrahtBot/bitcoin/builds/31864368 Open-Close to re-run ci. See #15847 (comment) |
|
utACK cd3b156 |
jonatack
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.
ACK cd3b156
It looks like we are close to being able to remove GetScriptForWitness as per:
src/script/standard.h:202: * TODO: replace calls to GetScriptForWitness with GetScriptForDestination using the various witness-specific CTxDestination subtypes.
| self.nodes[0].generate(1) | ||
| # Now create and sign a transaction spending that output on node[0], which doesn't know the scripts or keys | ||
| spending_tx = self.nodes[0].createrawtransaction([{'txid': txid, 'vout': vout}], {self.nodes[1].getnewaddress(): Decimal("9.999")}) | ||
| spending_tx_signed = self.nodes[0].signrawtransactionwithkey(spending_tx, [embedded_privkey], [{'txid': txid, 'vout': vout, 'scriptPubKey': script_pub_key, 'redeemScript': redeem_script, 'witnessScript': witness_script, 'amount': 10}]) |
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.
verified that reverting the change in rawtransaction_util.cpp::219 causes the test to fail here with redeemScript does not correspond to witnessScript (-8)
…Script for signrawtransaction cd3b156 Correctly compute redeemScript from witnessScript for signrawtransaction (Andrew Chow) Pull request description: `ParsePrevouts` uses `GetScriptForWitness` on the given witnessScript to find the corresponding redeemScript. This is incorrect when the witnessScript is either a P2PK or P2PKH script as it returns the corresponding P2WPK script instead of turning the witnessScript into a P2WSH script. Instead this should make the script a `WitnessV0ScriptHash` destination and get the script for that. Test cases are also added. These will fail on master with a `redeemScript does not correspond to witnessScript` Reported on [Bitcointalk](https://bitcointalk.org/index.php?topic=5236818.0) ACKs for top commit: MarcoFalke: weak ACK cd3b156, only checked that the test fails without the code change 🚰 instagibbs: utACK bitcoin@cd3b156 Tree-SHA512: afac671dbb52ce88bfb4a9ca3dd6065427ad52c9778d0549ad40e9286778f308adad24fb3b3c3089545d7f88c57c53d41224fd7a4bb207550eff2fe06600118f
…gging 9cdddae test: add rpc_signrawtransaction logging (Jon Atack) 4d6cde3 test: refactor rpc_signrawtransaction witness script tests (Jon Atack) Pull request description: As a follow-up to bitcoin#18484, the new tests are good but bury the one non-duplicate line in each test that sets the witness script, and there is no logging in the testfile. This PR makes it easy to see what is unique to each of the new tests and adds logging. ACKs for top commit: theStack: ACK bitcoin@9cdddae 🥚 🐰 Tree-SHA512: 7b1ca303326658afb90b7635abc9fe8bb65f0be004124d4dcf38702bb6f38bc06ce33c0642be4ad5d511453d003cdefeea691e66e3b963a4feb66f6237a3c241
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.
.
ParsePrevoutsusesGetScriptForWitnesson the given witnessScript to find the corresponding redeemScript. This is incorrect when the witnessScript is either a P2PK or P2PKH script as it returns the corresponding P2WPK script instead of turning the witnessScript into a P2WSH script. Instead this should make the script aWitnessV0ScriptHashdestination and get the script for that.Test cases are also added. These will fail on master with a
redeemScript does not correspond to witnessScriptReported on Bitcointalk