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.
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.
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.
If we do not have the public key for a P2PKH input, we should not
continue to attempt to sign for it.
@instagibbs I added a test
I can confirm this test fails on master. It also fixes the downstream issue I was seeing.
just to note this issue happens for any native "keyhash" type including native segwit, and this fixes that
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--174a7506f384e20aa4161008e828411d-->
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.<!--2502f1a698b3751726fa55edcda76cd3-->
| Coverage | Change (pull 14689) | Reference (master) |
|---|---|---|
| Lines | +0.0834 % | 87.0730 % |
| Functions | +0.0306 % | 84.3717 % |
| Branches | +0.0536 % | 51.5638 % |
<sup>Updated at: 2018-11-08T22:33:52.852772.</sup>
utACK 6b8d86ddb803d50d8608d95f7e8f791511dec8b9
Backport?
Marked for backport.
268 | @@ -269,6 +269,10 @@ def run_test(self): 269 | 270 | self.test_utxo_conversion() 271 | 272 | + # Test that psbts with p2pkh outputs are created properly 273 | + p2pkh = self.nodes[0].getnewaddress(address_type='legacy') 274 | + psbt = self.nodes[1].walletcreatefundedpsbt([], [{p2pkh : 1}], 0, {"includeWatching" : True}, True) 275 | + self.nodes[0].decodepsbt(psbt['psbt'])
I tried to backport, but the test passes even without the code changes.
Mind taking a look to backport this?
@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?