Repository navigation
gui: Use PSBT v0 - #36539
gui: Use PSBT v0#36539
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
I don't think we should be adding any GUI elements for a PR targeting a backport, particularly as it adds strings for translation. We can do v0 only in the GUI I guess. |
|
cc @hebasto |
That seems fine for now if it's easier. There could be a (release) note to use the RPC for v2 when needed. |
e84bc72 to
f0777e6
Compare
|
I've pushed so that the GUI just returns v0 PSBT's. |
|
Code review f0777e6.
I think it's better to consistently use v2 for external signers, both from the GUI and RPC. |
|
The GUI fee bump with an external signer still uses v2 ( Suggestion: a diffdiff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index 8862f94fab..da140f721e 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -175,7 +175,7 @@ public:
CMutableTransaction& mtx) = 0;
//! Sign bump transaction.
- virtual bool signBumpTransaction(CMutableTransaction& mtx) = 0;
+ virtual bool signBumpTransaction(CMutableTransaction& mtx, uint32_t psbt_version) = 0;
//! Commit bump transaction.
virtual bool commitBumpTransaction(const Txid& txid,
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 2422b88579..95454e2265 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -524,7 +524,7 @@ bool WalletModel::bumpFee(Txid hash, Txid& new_hash)
assert(!m_wallet->privateKeysDisabled() || wallet().hasExternalSigner());
// sign bumped transaction
- if (!m_wallet->signBumpTransaction(mtx)) {
+ if (!m_wallet->signBumpTransaction(mtx, /*psbt_version=*/0)) {
QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't sign transaction."));
return false;
}
diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp
index ab64fd8cda..1c7288aedd 100644
--- a/src/wallet/feebumper.cpp
+++ b/src/wallet/feebumper.cpp
@@ -336,13 +336,12 @@ Result CreateRateBumpTransaction(CWallet& wallet, const Txid& txid, const CCoinC
return Result::OK;
}
-bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx) {
+bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx, uint32_t psbt_version) {
LOCK(wallet.cs_wallet);
if (wallet.IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
- // 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);
+ // Make a blank psbt
+ PartiallySignedTransaction psbtx(mtx, psbt_version);
// First fill transaction with our data without signing,
// so external signers are not asked to sign more than once.
diff --git a/src/wallet/feebumper.h b/src/wallet/feebumper.h
index 4e0befe412..62faea52af 100644
--- a/src/wallet/feebumper.h
+++ b/src/wallet/feebumper.h
@@ -58,9 +58,10 @@ Result CreateRateBumpTransaction(CWallet& wallet,
std::optional<uint32_t> original_change_index = std::nullopt);
//! Sign the new transaction,
+//! @param psbt_version PSBT version passed to an external signer, if the wallet uses one
//! @return false if the tx couldn't be found or if it was
//! impossible to create the signature(s)
-bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx);
+bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx, uint32_t psbt_version);
//! Commit the bumpfee transaction.
//! @return success in case of CWallet::CommitTransaction was successful,
diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp
index a7d24ca0b9..3a70e88c3a 100644
--- a/src/wallet/interfaces.cpp
+++ b/src/wallet/interfaces.cpp
@@ -300,7 +300,7 @@ public:
std::vector<CTxOut> outputs; // just an empty list of new recipients for now
return feebumper::CreateRateBumpTransaction(*m_wallet.get(), txid, coin_control, errors, old_fee, new_fee, mtx, /* require_mine= */ true, outputs) == feebumper::Result::OK;
}
- bool signBumpTransaction(CMutableTransaction& mtx) override { return feebumper::SignTransaction(*m_wallet.get(), mtx); }
+ bool signBumpTransaction(CMutableTransaction& mtx, uint32_t psbt_version) override { return feebumper::SignTransaction(*m_wallet.get(), mtx, psbt_version); }
bool commitBumpTransaction(const Txid& txid,
CMutableTransaction&& mtx,
std::vector<bilingual_str>& errors,
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index e228298c0c..9de3464675 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -1138,7 +1138,8 @@ static RPCMethod bumpfee_helper(std::string method_name)
// For bumpfee, return the new transaction id.
// For psbtbumpfee, return the base64-encoded unsigned PSBT of the new transaction.
if (!want_psbt) {
- if (!feebumper::SignTransaction(*pwallet, mtx)) {
+ // External signers must support BIP-0370 (PSBT v2)
+ if (!feebumper::SignTransaction(*pwallet, mtx, /*psbt_version=*/2)) {
if (pwallet->IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
throw JSONRPCError(RPC_WALLET_ERROR, "Transaction incomplete. Try psbtbumpfee instead.");
} |
|
Pushed this to the |
f0777e6 to
f87dd18
Compare
PSBTv2 is not very interesting for current GUI users, and defaulting to it causes issues for existing users. To make this change minimal and avoid touching strings, this commit, only changes the default back instead of making the version configurable. The external signer PSBT will still be version 2, and I've added an explicit argument here to show that. This will break users who are using HWI versions < 2.1.0. (https://github.com/bitcoin-core/HWI/releases/tag/2.1.0)
f87dd18 to
3fdc45d
Compare
|
I've modified this so that the external signer PSBT's are v2, this breaks support with external signer software that doesn't know about v2, which is quite reasonable I think, so I've added a release note about that. |
|
ACK 3fdc45d Sadly we missed the 32.1 milestone, time flies. |
|
I've re-run previously cancelled CI jobs. |
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112
Save transaction always wrote a version 2 PSBT, which Bitcoin Core 31 and older reject, so a cosigner or offline signer on those releases could not load the file. Bitcoin-Qt went back to version 0 for its file exports in bitcoin/bitcoin#36539. Write a PSBT the app creates for saving as version 0. An imported PSBT is still saved back in the version it arrived with, and the external signer hand-off is unchanged. Check the version in the existing Save transaction integration test and in the ExportReview unit test. Fixes bitcoin-core#1112

This fixes: #36518
There is no test added here for the bump fee PSBT's being v0, since there aren't any existing tests for watch only wallet feebumping in the GUI. If reviewers insist on this I can add it, but I wanted to keep the diff minimal. I have tested this manually.
AFAIU for the external signer stuff it shouldn't matter much whether it's v0 or v2, since users are very unlikely to be using HWI software that doesn't speak v0, but out of caution I've set the external signer PSBT to v0 for the GUI.
This PR originally took the approach of adding a checkbox, (davidgumberg/gui/2026-10-15-psbt-gui), but this was dropped to simplify backporting past string freeze.
LLM Disclosure: The previous approach was drafted using an LLM, but this branch was written by me. I used an LLM to explore adding a fee bump watchonly GUI test, and decided against it.