Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2009-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_NODE_PSBT_H6#define BITCOIN_NODE_PSBT_H8#include <psbt.h>10#include <optional>12namespace node {13/**14* Holds an analysis of one input from a PSBT15*/16struct PSBTInputAnalysis {17bool has_utxo; //!< Whether we have UTXO information for this input18bool is_final; //!< Whether the input has all required information including signatures19PSBTRole next; //!< Which of the BIP 174 roles needs to handle this input next21std::vector<CKeyID> missing_pubkeys; //!< Pubkeys whose BIP32 derivation path is missing22std::vector<CKeyID> missing_sigs; //!< Pubkeys whose signatures are missing23uint160 missing_redeem_script; //!< Hash160 of redeem script, if missing24uint256 missing_witness_script; //!< SHA256 of witness script, if missing25};27/**28* Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)29*/30struct PSBTAnalysis {31std::optional<size_t> estimated_vsize; //!< Estimated weight of the transaction32std::optional<CFeeRate> estimated_feerate; //!< Estimated feerate (fee / weight) of the transaction33std::optional<CAmount> fee; //!< Amount of fee being paid by the transaction34std::vector<PSBTInputAnalysis> inputs; //!< More information about the individual inputs of the transaction35PSBTRole next; //!< Which of the BIP 174 roles needs to handle the transaction next36std::string error; //!< Error message38void SetInvalid(std::string err_msg)39{40estimated_vsize = std::nullopt;41estimated_feerate = std::nullopt;42fee = std::nullopt;43inputs.clear();44next = PSBTRole::CREATOR;45error = err_msg;46}47};49/**50* Provides helpful miscellaneous information about where a PSBT is in the signing workflow.51*52* @param[in] psbtx the PSBT to analyze53* @return A PSBTAnalysis with information about the provided PSBT.54*/55PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx);56} // namespace node58#endif // BITCOIN_NODE_PSBT_H