From 7eacc21ff67a78860c76f18cf551c201a4b78f3e Mon Sep 17 00:00:00 2001 From: Ava Chow Date: Tue, 17 Mar 2026 11:33:47 -0700 Subject: [PATCH] psbt: make PSBT structs into classes --- src/external_signer.h | 2 +- src/interfaces/wallet.h | 2 +- src/psbt.h | 9 ++++++--- src/wallet/wallet.h | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/external_signer.h b/src/external_signer.h index 5ba37c0626b..87fbbf0b8c2 100644 --- a/src/external_signer.h +++ b/src/external_signer.h @@ -11,7 +11,7 @@ #include #include -struct PartiallySignedTransaction; +class PartiallySignedTransaction; //! Enables interaction with an external signing device or service, such as //! a hardware wallet. See doc/external-signer.md diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index ab142080fc6..d21163171d5 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -32,7 +32,7 @@ class CFeeRate; class CKey; enum class FeeReason; enum class OutputType; -struct PartiallySignedTransaction; +class PartiallySignedTransaction; struct bilingual_str; namespace common { enum class PSBTError; diff --git a/src/psbt.h b/src/psbt.h index 719d68d9213..f6bf144ab8d 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -261,8 +261,9 @@ static inline void ExpectedKeySize(const std::string& key_name, const std::vecto } /** A structure for PSBTs which contain per-input information */ -struct PSBTInput +class PSBTInput { +public: CTransactionRef non_witness_utxo; CTxOut witness_utxo; CScript redeem_script; @@ -791,8 +792,9 @@ struct PSBTInput }; /** A structure for PSBTs which contains per output information */ -struct PSBTOutput +class PSBTOutput { +public: CScript redeem_script; CScript witness_script; std::map hd_keypaths; @@ -1027,8 +1029,9 @@ struct PSBTOutput }; /** A version of CTransaction with the PSBT format*/ -struct PartiallySignedTransaction +class PartiallySignedTransaction { +public: std::optional tx; // We use a vector of CExtPubKey in the event that there happens to be the same KeyOriginInfos for different CExtPubKeys // Note that this map swaps the key and values from the serialization diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index cbf3efc0376..d066edf8150 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -74,7 +74,7 @@ struct CBlockLocator; struct CExtKey; struct FlatSigningProvider; struct KeyOriginInfo; -struct PartiallySignedTransaction; +class PartiallySignedTransaction; struct SignatureData; using LoadWalletFn = std::function wallet)>;