MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / PrecomputePSBTData

Function PrecomputePSBTData

src/psbt.cpp:626–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624}
625
626std::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
647PSBTError SignPSBTInput(const SigningProvider& provider, PartiallySignedTransaction& psbt, int index, const PrecomputedTransactionData* txdata, const common::PSBTFillOptions& options, SignatureData* out_sigdata)
648{

Callers 5

FinalizePSBTFunction · 0.85
FillPSBTMethod · 0.85
ProcessPSBTFunction · 0.85
AnalyzePSBTFunction · 0.85

Calls 4

GetUnsignedTxMethod · 0.80
GetUTXOMethod · 0.80
emplace_backMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected