| 624 | } |
| 625 | |
| 626 | std::optional<PrecomputedTransactionData> PrecomputePSBTData(const PartiallySignedTransaction& psbt) |
| 627 | { |
| 628 | std::optional<CMutableTransaction> unsigned_tx = psbt.GetUnsignedTx(); |
| 629 | if (!unsigned_tx) { |
| 630 | return std::nullopt; |
| 631 | } |
| 632 | const CMutableTransaction& tx = *unsigned_tx; |
| 633 | bool have_all_spent_outputs = true; |
| 634 | std::vector<CTxOut> utxos; |
| 635 | for (const PSBTInput& input : psbt.inputs) { |
| 636 | if (!input.GetUTXO(utxos.emplace_back())) have_all_spent_outputs = false; |
| 637 | } |
| 638 | PrecomputedTransactionData txdata; |
| 639 | if (have_all_spent_outputs) { |
| 640 | txdata.Init(tx, std::move(utxos), true); |
| 641 | } else { |
| 642 | txdata.Init(tx, {}, true); |
| 643 | } |
| 644 | return txdata; |
| 645 | } |
| 646 | |
| 647 | PSBTError SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& psbt, int index, const PrecomputedTransactionData* txdata, const common::PSBTFillOptions& options, SignatureData* out_sigdata) |
| 648 | { |
no test coverage detected