Merge bitcoin/bitcoin#36539: gui: Use PSBT v0
What changed, and why it matters
This change makes the Bitcoin Core graphical wallet produce older PSBT v0 files instead of PSBT v2 in several common user flows (creating unsigned transactions, bumping fees). PSBT v2 is newer and not supported by some older external signer tools/hardware wallet software. By defaulting to v0 in the GUI, the wallet stays compatible with more hardware signing tools. The change also removes the automatic default version from the PSBT constructor so callers must explicitly choose a version. This is a compatibility/usability fix, not a fix for theft-of-funds or remote code execution.
Treat as a compatibility/usability fix rather than a critical security patch. Backport to affected release branches if users are encountering unusable PSBTs with external signers. No urgent deployment required for security reasons, but verify that downstream GUI users with hardware wallets no longer receive unsupported PSBT v2 files for normal unsigned/fee-bump flows.
Security signals we found
Constructor default version removed, making version choice explicit at every call site
GUI unsigned transaction creation switched from implicit PSBT v2 to explicit PSBT v0
GUI fee-bump PSBT switched from implicit PSBT v2 to explicit PSBT v0
External-signer code paths deliberately keep PSBT v2 with explanatory comments
Release note added stating external signer software must support PSBTv2 / HWI >= 2.1.0
No cryptographic, consensus, or network-layer changes observed
Evidence from the diff
The merge removes the default version = 2 argument from PartiallySignedTransaction(const CMutableTransaction&, uint32_t) and forces all call sites to pass an explicit version. In the GUI (sendcoinsdialog.cpp, walletmodel.cpp bump fee) it now constructs PSBTs as version 0, restoring compatibility with external signers that only understand BIP-174 (PSBT v0). External-signer paths in sendcoinsdialog.cpp and wallet/feebumper.cpp intentionally remain version 2 because those flows already require BIP-370-capable signer software. Tests and fuzz targets are updated to pass version 2 explicitly where they previously relied on the default. A release note documents the HWI minimum version requirement.
Changed components
src/psbt.h - PartiallySignedTransaction constructor signaturesrc/qt/sendcoinsdialog.cpp - unsigned and external-signer PSBT creationsrc/qt/walletmodel.cpp - bump fee PSBT creationsrc/wallet/feebumper.cpp - external signer fee bump PSBT creationsrc/qt/test/wallettests.cpp - watch-only GUI PSBT version assertionsrc/test/fuzz/psbt.cpp - fuzz target explicit versionsrc/test/psbt_tests.cpp - unit tests explicit versiondoc/release-notes-hwi-minver.md - release documentationInspect captured patch +24 / −10
### doc/release-notes-hwi-minver.md
@@ -0,0 +1,10 @@
+Wallet
+------
+
+As of the introduction of PSBTv2 support in 32.0, Bitcoin Core is no longer
+compatible with external signer software that does not support PSBTv2. This does
+not mean users need to have hardware wallets that support PSBTv2, only that
+users that start bitcoind with an external signer set via `-signer=<cmd>`, will
+need to be using an external signing tool, like HWI, which supports PSBTv2. For
+users of HWI, this means a minimum version of 2.1.0 (released in 2022) is
+required. (https://github.com/bitcoin-core/HWI/releases/tag/2.1.0)
### src/psbt.h
@@ -1266,7 +1266,7 @@ class PartiallySignedTransaction
std::optional<uint32_t> ComputeTimeLock() const;
std::optional<CMutableTransaction> GetUnsignedTx() const;
std::optional<Txid> GetUniqueID() const;
- explicit PartiallySignedTransaction(const CMutableTransaction& tx, uint32_t version = 2);
+ explicit PartiallySignedTransaction(const CMutableTransaction& tx, uint32_t version);
template <typename Stream>
inline void Serialize(Stream& s) const {
### src/qt/sendcoinsdialog.cpp
@@ -487,7 +487,7 @@ void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
if (retval == QMessageBox::Save) {
// "Create Unsigned" clicked
CMutableTransaction mtx = CMutableTransaction{*(m_current_transaction->getWtx())};
- PartiallySignedTransaction psbtx(mtx);
+ PartiallySignedTransaction psbtx(mtx, /*version=*/0);
bool complete = false;
// Fill without signing
const auto err{model->wallet().fillPSBT({.sign = false, .bip32_derivs = true}, /*n_signed=*/nullptr, psbtx, complete)};
@@ -502,7 +502,9 @@ void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
bool broadcast = true;
if (model->wallet().hasExternalSigner()) {
CMutableTransaction mtx = CMutableTransaction{*(m_current_transaction->getWtx())};
- PartiallySignedTransaction psbtx(mtx);
+ // Version 2 means that users will need to have an
+ // external signer software that supports BIP-0370.
+ PartiallySignedTransaction psbtx(mtx, /*version=*/2);
bool complete = false;
// Always fill without signing first. This prevents an external signer
// from being called prematurely and is not expensive.
### src/qt/test/wallettests.cpp
@@ -430,6 +430,7 @@ void TestGUIWatchOnly(interfaces::Node& node, TestChain100Setup& test)
QVERIFY(decoded_psbt);
util::Result<PartiallySignedTransaction> psbt = DecodeRawPSBT(MakeByteSpan(*decoded_psbt));
QVERIFY(psbt);
+ QCOMPARE(psbt->GetVersion(), 0);
}
void TestGUI(interfaces::Node& node)
### src/qt/walletmodel.cpp
@@ -501,7 +501,7 @@ bool WalletModel::bumpFee(Txid hash, Txid& new_hash)
// Short-circuit if we are returning a bumped transaction PSBT to clipboard
if (retval == QMessageBox::Save) {
// "Create Unsigned" clicked
- PartiallySignedTransaction psbtx(mtx);
+ PartiallySignedTransaction psbtx(mtx, /*version=*/0);
bool complete = false;
const auto err{wallet().fillPSBT({.sign = false, .bip32_derivs = true}, nullptr, psbtx, complete)};
if (err || complete) {
### src/test/fuzz/psbt.cpp
@@ -125,7 +125,7 @@ FUZZ_TARGET(psbt)
psbt_mut = psbt;
CMutableTransaction result;
if (FinalizeAndExtractPSBT(psbt_mut, result)) {
- const PartiallySignedTransaction psbt_from_tx{result};
+ const PartiallySignedTransaction psbt_from_tx{result, /*version=*/2};
}
PartiallySignedTransaction psbt_merge = psbt;
### src/test/psbt_tests.cpp
@@ -196,8 +196,8 @@ BOOST_AUTO_TEST_CASE(merge_proprietary_fields)
tx.vin.emplace_back(COutPoint{});
tx.vout.emplace_back(0, CScript{});
- PartiallySignedTransaction left(tx);
- PartiallySignedTransaction right(tx);
+ PartiallySignedTransaction left(tx, /*version=*/2);
+ PartiallySignedTransaction right(tx, /*version=*/2);
const auto left_prop = MakeProprietary(/*subtype=*/1, /*key_data=*/0x01, /*value=*/0xaa);
const auto right_prop = MakeProprietary(/*subtype=*/2, /*key_data=*/0x02, /*value=*/0xbb);
@@ -255,7 +255,7 @@ struct PSBTOutputTest {
CMutableTransaction tx;
if (has_input) tx.vin.emplace_back();
tx.vout.emplace_back(0, script_pubkey);
- PartiallySignedTransaction psbt{tx};
+ PartiallySignedTransaction psbt{tx, /*version=*/2};
UpdatePSBTOutput(provider, psbt, 0);
return psbt.outputs[0];
}
### src/wallet/feebumper.cpp
@@ -340,8 +340,9 @@ bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx) {
LOCK(wallet.cs_wallet);
if (wallet.IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
- // Make a blank psbt
- PartiallySignedTransaction psbtx(mtx);
+ // Make a blank PSBT, this means that users will need to have an
+ // external signer software that supports BIP-0370.
+ PartiallySignedTransaction psbtx(mtx, /*version=*/2);
// First fill transaction with our data without signing,
// so external signers are not asked to sign more than once.Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.