| 162 | } |
| 163 | |
| 164 | void UpdatePSBTOutput(const SigningProvider &provider, |
| 165 | PartiallySignedTransaction &psbt, int index) { |
| 166 | CMutableTransaction &tx = *Assert(psbt.tx); |
| 167 | const CTxOut &out = tx.vout.at(index); |
| 168 | PSBTOutput &psbt_out = psbt.outputs.at(index); |
| 169 | |
| 170 | // Fill a SignatureData with output info |
| 171 | SignatureData sigdata; |
| 172 | psbt_out.FillSignatureData(sigdata); |
| 173 | |
| 174 | // Construct a would-be spend of this output, to update sigdata with. |
| 175 | // Note that ProduceSignature is used to fill in metadata (not actual |
| 176 | // signatures), so provider does not need to provide any private keys (it |
| 177 | // can be a HidingSigningProvider). |
| 178 | MutableTransactionSignatureCreator creator(&tx, /* index */ 0, out.nValue, |
| 179 | SigHashType().withForkId()); |
| 180 | ProduceSignature(provider, creator, out.scriptPubKey, sigdata); |
| 181 | |
| 182 | // Put redeem_script and key paths, into PSBTOutput. |
| 183 | psbt_out.FromSignatureData(sigdata); |
| 184 | } |
| 185 | |
| 186 | bool SignPSBTInput(const SigningProvider &provider, |
| 187 | PartiallySignedTransaction &psbt, int index, |
no test coverage detected