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

Require a public key to be retrieved when signing a P2PKH input #14689

Merged
merged 1 commit into from Nov 10, 2018

Conversation

Projects
None yet
8 participants
@achow101
Copy link
Member

commented Nov 8, 2018

If we do not have the public key for a P2PKH input, we should not continue to attempt to sign for it.

This fixes a problem where a PSBT with a P2PKH output would include invalid BIP 32 derivation paths that are missing the public key.

@instagibbs

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

This deserves a regression test. Have a walletcreatefundedpsbt call in rpc_psbt.py just make an output to a p2pkh output it doesn't control, do a PSBT decoding round trip. In fact, let's do it for all standard output types.

@instagibbs

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

utACK otherwise 409564a

Require a public key to be retrieved when signing a P2PKH input
If we do not have the public key for a P2PKH input, we should not
continue to attempt to sign for it.

@achow101 achow101 force-pushed the achow101:fix-pkh-pubkeys branch to 6b8d86d Nov 8, 2018

@achow101

This comment has been minimized.

Copy link
Member Author

commented Nov 8, 2018

@instagibbs I added a test

@Sjors

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

I can confirm this test fails on master. It also fixes the downstream issue I was seeing.

@instagibbs

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

just to note this issue happens for any native "keyhash" type including native segwit, and this fixes that

@DrahtBot

This comment has been minimized.

Copy link
Contributor

commented Nov 8, 2018

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #13932 (Additional utility RPCs for PSBT by achow101)

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.

Coverage

Coverage Change (pull 14689) Reference (master)
Lines +0.0834 % 87.0730 %
Functions +0.0306 % 84.3717 %
Branches +0.0536 % 51.5638 %

Updated at: 2018-11-08T22:33:52.852772.

@meshcollider meshcollider added the Wallet label Nov 8, 2018

@meshcollider

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

utACK 6b8d86d

1 similar comment
@instagibbs

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

utACK 6b8d86d

@sipa

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

utACK 6b8d86d

@sipa sipa merged commit 6b8d86d into bitcoin:master Nov 10, 2018

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details

sipa added a commit that referenced this pull request Nov 10, 2018

Merge #14689: Require a public key to be retrieved when signing a P2P…
…KH input

6b8d86d Require a public key to be retrieved when signing a P2PKH input (Andrew Chow)

Pull request description:

  If we do not have the public key for a P2PKH input, we should not continue to attempt to sign for it.

  This fixes a problem where a PSBT with a P2PKH output would include invalid BIP 32 derivation paths that are missing the public key.

Tree-SHA512: 850d5e74c06833da937d5bf0348bd134180be7167b6f9b9cecbf09f75e3543fbad60d0abbc0b9afdfa51ce165aa36168849f24a7c5abf1e75f37ce8f9a13d127

@bitcoin bitcoin deleted a comment from WorkShop-Office Nov 10, 2018

laanwj added a commit that referenced this pull request Nov 13, 2018

Merge #14690: Throw error if CPubKey is invalid during PSBT keypath s…
…erialization

4e4de10 Throw error if CPubKey is invalid during PSBT keypath serialization (Gregory Sanders)

Pull request description:

  Related to #14689

  We should catch this error before attempting to deserialize it later.

Tree-SHA512: d2f3ea7f363818ac70c81ee988231b2bb50d055b6919f7bff3f27120c85a7048bfa183efae33e23e6b81d684bcb8bb81e5b209abb3acbcaff1d88014f4f1aa93
@gmaxwell

This comment has been minimized.

Copy link
Member

commented Nov 20, 2018

Backport?

@sipa sipa added the Needs backport label Nov 22, 2018

@sipa

This comment has been minimized.

Copy link
Member

commented Nov 22, 2018

Marked for backport.

@MarcoFalke MarcoFalke added this to the 0.17.1 milestone Nov 30, 2018

# Test that psbts with p2pkh outputs are created properly
p2pkh = self.nodes[0].getnewaddress(address_type='legacy')
psbt = self.nodes[1].walletcreatefundedpsbt([], [{p2pkh : 1}], 0, {"includeWatching" : True}, True)
self.nodes[0].decodepsbt(psbt['psbt'])

This comment has been minimized.

Copy link
@MarcoFalke

MarcoFalke Dec 5, 2018

Member

I tried to backport, but the test passes even without the code changes.

Mind taking a look to backport this?

This comment has been minimized.

Copy link
@meshcollider

meshcollider Dec 6, 2018

Member

@MarcoFalke I believe the issue only arose after #14424 (which is also marked for backport), does the test fail if you backport that at the same time?

@meshcollider meshcollider removed this from the 0.17.1 milestone Dec 6, 2018

@meshcollider

This comment has been minimized.

Copy link
Member

commented Dec 6, 2018

@achow101 said on IRC that #13723 may have been involved with producing the bug too so its not present on 0.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.