| 28 | } |
| 29 | |
| 30 | FUZZ_TARGET_INIT(psbt, initialize_psbt) |
| 31 | { |
| 32 | FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()}; |
| 33 | PartiallySignedTransaction psbt_mut; |
| 34 | // ELEMENTS: needed as Solver depends on Params() |
| 35 | SelectParams(CBaseChainParams::LIQUID1); |
| 36 | std::string error; |
| 37 | if (!DecodeRawPSBT(psbt_mut, fuzzed_data_provider.ConsumeRandomLengthString(), error)) { |
| 38 | return; |
| 39 | } |
| 40 | const PartiallySignedTransaction psbt = psbt_mut; |
| 41 | |
| 42 | const PSBTAnalysis analysis = AnalyzePSBT(psbt); |
| 43 | (void)PSBTRoleName(analysis.next); |
| 44 | for (const PSBTInputAnalysis& input_analysis : analysis.inputs) { |
| 45 | (void)PSBTRoleName(input_analysis.next); |
| 46 | } |
| 47 | |
| 48 | (void)psbt.IsNull(); |
| 49 | |
| 50 | const CMutableTransaction& mtx = psbt.GetUnsignedTx(); |
| 51 | const PartiallySignedTransaction psbt_from_tx{mtx}; |
| 52 | |
| 53 | for (const PSBTInput& input : psbt.inputs) { |
| 54 | (void)PSBTInputSigned(input); |
| 55 | (void)input.IsNull(); |
| 56 | } |
| 57 | (void)CountPSBTUnsignedInputs(psbt); |
| 58 | |
| 59 | for (const PSBTOutput& output : psbt.outputs) { |
| 60 | (void)output.IsNull(); |
| 61 | } |
| 62 | |
| 63 | for (const auto& input : psbt.inputs) { |
| 64 | CTxOut tx_out; |
| 65 | if (input.GetUTXO(tx_out)) { |
| 66 | (void)tx_out.IsNull(); |
| 67 | (void)tx_out.ToString(); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | psbt_mut = psbt; |
| 72 | (void)FinalizePSBT(psbt_mut); |
| 73 | |
| 74 | psbt_mut = psbt; |
| 75 | CMutableTransaction result; |
| 76 | if (FinalizeAndExtractPSBT(psbt_mut, result)) { |
| 77 | const PartiallySignedTransaction psbt_from_tx{result}; |
| 78 | } |
| 79 | |
| 80 | PartiallySignedTransaction psbt_merge; |
| 81 | if (!DecodeRawPSBT(psbt_merge, fuzzed_data_provider.ConsumeRandomLengthString(), error)) { |
| 82 | psbt_merge = psbt; |
| 83 | } |
| 84 | psbt_mut = psbt; |
| 85 | (void)psbt_mut.Merge(psbt_merge); |
| 86 | psbt_mut = psbt; |
| 87 | (void)CombinePSBTs(psbt_mut, {psbt_mut, psbt_merge}); |
nothing calls this directly
no test coverage detected