Skip to content
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

fix converttopsbt permitsigdata arg, add basic test #14356

Merged
merged 1 commit into from
Nov 12, 2018

Conversation

instagibbs
Copy link
Member

The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

Resolves #14355

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for backport?

@@ -107,6 +107,9 @@ def run_test(self):
# Make sure that a psbt with signatures cannot be converted
signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].converttopsbt, signedtx['hex'])
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].converttopsbt, signedtx['hex'], False)
# Unless we allow it to convert and strip signatures
self.nodes[0].converttopsbt(signedtx['hex'], True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could use named args permitsigdata=True/False?

@instagibbs
Copy link
Member Author

instagibbs commented Oct 1, 2018 via email

@maflcko maflcko added this to the 0.17.1 milestone Oct 1, 2018
@achow101
Copy link
Member

achow101 commented Oct 1, 2018

utACK 88a79cb

@promag
Copy link
Member

promag commented Oct 1, 2018

utACK 88a79cb.

@@ -1669,7 +1669,7 @@ UniValue converttopsbt(const JSONRPCRequest& request)

// Remove all scriptSigs and scriptWitnesses from inputs
for (CTxIn& input : tx.vin) {
if ((!input.scriptSig.empty() || !input.scriptWitness.IsNull()) && (request.params[1].isNull() || (!request.params[1].isNull() && request.params[1].get_bool()))) {
if ((!input.scriptSig.empty() || !input.scriptWitness.IsNull()) && !permitsigdata) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have the !request.params[1].isNull() in line 1661 above?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? permitsigdata is enough?

@meshcollider
Copy link
Contributor

utACK 88a79cb

@sipa
Copy link
Member

sipa commented Nov 12, 2018

utACK 88a79cb

@laanwj laanwj merged commit 88a79cb into bitcoin:master Nov 12, 2018
laanwj added a commit that referenced this pull request Nov 12, 2018
88a79cb fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders)

Pull request description:

  The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

  Resolves #14355

Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Dec 5, 2018
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request May 11, 2020
Summary:
The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

---

This is a backport of Core [[bitcoin/bitcoin#14356 | PR14356]]

Test Plan:
  ninja check
  ./test_runner.py rpc_psbt

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6026
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jul 15, 2021
88a79cb fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders)

Pull request description:

  The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

  Resolves bitcoin#14355

Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Jul 15, 2021
88a79cb fix converttopsbt permitsigdata arg, add basic test (Gregory Sanders)

Pull request description:

  The final check for extraneous sigdata has a flipped boolean, resulting in incorrect behavior.

  Resolves bitcoin#14355

Tree-SHA512: 5157a74b8ddebd7d836fba96765c4d7ed15a73d4289817353d3566a0f6803bd4bbc3f936735c517c7a83a6cbdb4052b9c61d23f6cc4ad00a6077278cd51adbd4
UdjinM6 added a commit to dashpay/dash that referenced this pull request Jul 16, 2021
Merge bitcoin#14356: fix converttopsbt permitsigdata arg, add basic test
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

has anyone tested converttopsbt?
9 participants