| 798 | } |
| 799 | |
| 800 | bool FinalizePSBT(PartiallySignedTransaction& psbtx) |
| 801 | { |
| 802 | // Finalize input signatures -- in case we have partial signatures that add up to a complete |
| 803 | // signature, but have not combined them yet (e.g. because the combiner that created this |
| 804 | // PartiallySignedTransaction did not understand them), this will combine them into a final |
| 805 | // script. |
| 806 | bool complete = true; |
| 807 | std::optional<PrecomputedTransactionData> txdata_res = PrecomputePSBTData(psbtx); |
| 808 | if (!txdata_res) { |
| 809 | return false; |
| 810 | } |
| 811 | const PrecomputedTransactionData& txdata = *txdata_res; |
| 812 | for (unsigned int i = 0; i < psbtx.inputs.size(); ++i) { |
| 813 | PSBTInput& input = psbtx.inputs.at(i); |
| 814 | complete &= (SignPSBTInput(DUMMY_SIGNING_PROVIDER, psbtx, i, &txdata, {.sighash_type = input.sighash_type, .finalize = true}, /*out_sigdata=*/nullptr) == PSBTError::OK); |
| 815 | } |
| 816 | |
| 817 | return complete; |
| 818 | } |
| 819 | |
| 820 | bool FinalizeAndExtractPSBT(PartiallySignedTransaction& psbtx, CMutableTransaction& result) |
| 821 | { |