blob: 0b4588c4ce5df803c2d0f62a827644cde8ca1040 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
// Copyright (c) 2019-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <test/fuzz/fuzz.h>
#include <node/psbt.h>
#include <optional.h>
#include <psbt.h>
#include <pubkey.h>
#include <script/script.h>
#include <streams.h>
#include <util/memory.h>
#include <version.h>
#include <cstdint>
#include <string>
#include <vector>
void initialize_psbt()
{
static const ECCVerifyHandle verify_handle;
}
FUZZ_TARGET_INIT(psbt, initialize_psbt)
{
PartiallySignedTransaction psbt_mut;
const std::string raw_psbt{buffer.begin(), buffer.end()};
std::string error;
if (!DecodeRawPSBT(psbt_mut, raw_psbt, error)) {
return;
}
const PartiallySignedTransaction psbt = psbt_mut;
const PSBTAnalysis analysis = AnalyzePSBT(psbt);
(void)PSBTRoleName(analysis.next);
for (const PSBTInputAnalysis& input_analysis : analysis.inputs) {
(void)PSBTRoleName(input_analysis.next);
}
(void)psbt.IsNull();
Optional<CMutableTransaction> tx = psbt.tx;
if (tx) {
const CMutableTransaction& mtx = *tx;
const PartiallySignedTransaction psbt_from_tx{mtx};
}
for (const PSBTInput& input : psbt.inputs) {
(void)PSBTInputSigned(input);
(void)input.IsNull();
}
for (const PSBTOutput& output : psbt.outputs) {
(void)output.IsNull();
}
for (size_t i = 0; i < psbt.tx->vin.size(); ++i) {
CTxOut tx_out;
if (psbt.GetInputUTXO(tx_out, i)) {
(void)tx_out.IsNull();
(void)tx_out.ToString();
}
}
psbt_mut = psbt;
(void)FinalizePSBT(psbt_mut);
psbt_mut = psbt;
CMutableTransaction result;
if (FinalizeAndExtractPSBT(psbt_mut, result)) {
const PartiallySignedTransaction psbt_from_tx{result};
}
psbt_mut = psbt;
(void)psbt_mut.Merge(psbt);
}
|