38 Assert(psbt_version == 0 || psbt_version == 2);
41 std::vector<uint8_t> psbt_ser;
47 std::vector<uint8_t> roundtrip_ser;
49 Assert(psbt_ser == roundtrip_ser);
73 input_fill.FromSignatureData(sig_data);
93 Assert(input_mod == input_fill);
105 output_fill.FromSignatureData(sig_data);
115 std::sort(output_fill.m_tap_tree.begin(), output_fill.m_tap_tree.end());
122 Assert(output_mod == output_fill);
137 if (psbt_merge_res) {
138 psbt_merge = *psbt_merge_res;
141 (void)psbt_mut.
Merge(psbt_merge);
143 std::optional<PartiallySignedTransaction> comb_res =
CombinePSBTs({psbt_mut, psbt_merge});
145 psbt_mut = *comb_res;
147 for (
const auto& psbt_in : psbt_merge.
inputs) {
150 for (
const auto& psbt_out : psbt_merge.
outputs) {
#define Assert(val)
Identity function.
An output of a transaction.
std::string ToString() const
std::string ConsumeRandomLengthString(size_t max_length)
A structure for PSBTs which contains per output information.
XOnlyPubKey m_tap_internal_key
std::set< PSBTProprietary > m_proprietary
std::vector< std::tuple< uint8_t, uint8_t, std::vector< unsigned char > > > m_tap_tree
std::map< std::vector< unsigned char >, std::vector< unsigned char > > unknown
void FillSignatureData(SignatureData &sigdata) const
A version of CTransaction with the PSBT format.
uint32_t GetVersion() const
bool Merge(const PartiallySignedTransaction &psbt)
Merge psbt into this.
std::map< std::vector< unsigned char >, std::vector< unsigned char > > unknown
std::vector< PSBTInput > inputs
std::optional< CMutableTransaction > GetUnsignedTx() const
std::vector< PSBTOutput > outputs
bool AddOutput(const PSBTOutput &psbtout)
bool AddInput(const PSBTInput &psbtin)
Minimal stream for reading from an existing byte array by std::span.
const unsigned char * end() const
const unsigned char * begin() const
bool IsFullyValid() const
Determine if this pubkey is fully valid.
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
Provides helpful miscellaneous information about where a PSBT is in the signing workflow.
std::string PSBTRoleName(PSBTRole role)
std::optional< PartiallySignedTransaction > CombinePSBTs(const std::vector< PartiallySignedTransaction > &psbtxs)
Combines PSBTs with the same underlying transaction, resulting in a single PSBT with all partial sign...
void RemoveUnnecessaryTransactions(PartiallySignedTransaction &psbtx)
Reduces the size of the PSBT by dropping unnecessary non_witness_utxos (i.e.
size_t CountPSBTUnsignedInputs(const PartiallySignedTransaction &psbt)
Counts the unsigned inputs of a PSBT.
bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result)
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
bool PSBTInputSigned(const PSBTInput &input)
Checks whether a PSBTInput is already signed by checking for non-null finalized fields.
bool FinalizePSBT(PartiallySignedTransaction &psbtx)
Finalizes a PSBT if possible, combining partial signatures.
util::Result< PartiallySignedTransaction > DecodeRawPSBT(std::span< const std::byte > tx_data)
Decode a raw (binary blob) PSBT into a PartiallySignedTransaction.
constexpr deserialize_type deserialize
auto MakeByteSpan(const V &v) noexcept
A mutable version of CTransaction.
bool complete
Stores whether the scriptSig and scriptWitness are complete.
Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)
std::vector< PSBTInputAnalysis > inputs
More information about the individual inputs of the transaction.
PSBTRole next
Which of the BIP 174 roles needs to handle the transaction next.
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
@ ZEROS
Seed with a compile time constant of zeros.
FuzzedDataProvider & fuzzed_data_provider