aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/script/sign.cpp2
-rwxr-xr-xtest/functional/rpc_psbt.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 69ee08ffd7..2795dc96d3 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -123,7 +123,7 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator
case TX_PUBKEYHASH: {
CKeyID keyID = CKeyID(uint160(vSolutions[0]));
CPubKey pubkey;
- GetPubKey(provider, sigdata, keyID, pubkey);
+ if (!GetPubKey(provider, sigdata, keyID, pubkey)) return false;
if (!CreateSig(creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) return false;
ret.push_back(std::move(sig));
ret.push_back(ToByteVector(pubkey));
diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py
index 86b043176c..ba3818bf24 100755
--- a/test/functional/rpc_psbt.py
+++ b/test/functional/rpc_psbt.py
@@ -276,6 +276,10 @@ class PSBTTest(BitcoinTestFramework):
self.test_utxo_conversion()
+ # 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'])
if __name__ == '__main__':
PSBTTest().main()