diff --git a/src/psbt.cpp b/src/psbt.cpp --- a/src/psbt.cpp +++ b/src/psbt.cpp @@ -4,6 +4,7 @@ #include +#include #include PartiallySignedTransaction::PartiallySignedTransaction( @@ -162,7 +163,8 @@ void UpdatePSBTOutput(const SigningProvider &provider, PartiallySignedTransaction &psbt, int index) { - const CTxOut &out = psbt.tx->vout.at(index); + CMutableTransaction &tx = *Assert(psbt.tx); + const CTxOut &out = tx.vout.at(index); PSBTOutput &psbt_out = psbt.outputs.at(index); // Fill a SignatureData with output info @@ -173,9 +175,8 @@ // Note that ProduceSignature is used to fill in metadata (not actual // signatures), so provider does not need to provide any private keys (it // can be a HidingSigningProvider). - MutableTransactionSignatureCreator creator( - psbt.tx ? &psbt.tx.value() : nullptr, /* index */ 0, out.nValue, - SigHashType().withForkId()); + MutableTransactionSignatureCreator creator(&tx, /* index */ 0, out.nValue, + SigHashType().withForkId()); ProduceSignature(provider, creator, out.scriptPubKey, sigdata); // Put redeem_script and key paths, into PSBTOutput.