Skip to content

Commit f47e802

Browse files
committed
Rearrange fillPSBT arguments
Move fillPSBT input-output argument before output-only arguments. This is a temporary workaround which can go away with improvements to libmultiprocess code generator. Currently code generator figures out order of input-output parameters by looking at input list, but it would make more sense for it to take order from output list, so input-only parameters still have to be first but there is more flexibility for the other parameters.
1 parent 1704bbf commit f47e802

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/interfaces/wallet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ class Wallet
198198
virtual TransactionError fillPSBT(int sighash_type,
199199
bool sign,
200200
bool bip32derivs,
201+
size_t* n_signed,
201202
PartiallySignedTransaction& psbtx,
202-
bool& complete,
203-
size_t* n_signed) = 0;
203+
bool& complete) = 0;
204204

205205
//! Get balances.
206206
virtual WalletBalances getBalances() = 0;

src/qt/psbtoperationsdialog.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void PSBTOperationsDialog::openWithPSBT(PartiallySignedTransaction psbtx)
5050
bool complete;
5151
size_t n_could_sign;
5252
FinalizePSBT(psbtx); // Make sure all existing signatures are fully combined before checking for completeness.
53-
TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, m_transaction_data, complete, &n_could_sign);
53+
TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, &n_could_sign, m_transaction_data, complete);
5454
if (err != TransactionError::OK) {
5555
showStatus(tr("Failed to load transaction: %1")
5656
.arg(QString::fromStdString(TransactionErrorString(err).translated)), StatusLevel::ERR);
@@ -67,7 +67,7 @@ void PSBTOperationsDialog::signTransaction()
6767
{
6868
bool complete;
6969
size_t n_signed;
70-
TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, true /* sign */, true /* bip32derivs */, m_transaction_data, complete, &n_signed);
70+
TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, true /* sign */, true /* bip32derivs */, &n_signed, m_transaction_data, complete);
7171

7272
if (err != TransactionError::OK) {
7373
showStatus(tr("Failed to sign transaction: %1")
@@ -226,7 +226,7 @@ void PSBTOperationsDialog::showStatus(const QString &msg, StatusLevel level) {
226226
size_t PSBTOperationsDialog::couldSignInputs(const PartiallySignedTransaction &psbtx) {
227227
size_t n_signed;
228228
bool complete;
229-
TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, false /* bip32derivs */, m_transaction_data, complete, &n_signed);
229+
TransactionError err = m_wallet_model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, false /* bip32derivs */, &n_signed, m_transaction_data, complete);
230230

231231
if (err != TransactionError::OK) {
232232
return 0;

src/qt/sendcoinsdialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,12 @@ void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
414414
bool complete = false;
415415
// Always fill without signing first. This prevents an external signer
416416
// from being called prematurely and is not expensive.
417-
TransactionError err = model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, psbtx, complete, nullptr);
417+
TransactionError err = model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, nullptr, psbtx, complete);
418418
assert(!complete);
419419
assert(err == TransactionError::OK);
420420
if (model->wallet().hasExternalSigner()) {
421421
try {
422-
err = model->wallet().fillPSBT(SIGHASH_ALL, true /* sign */, true /* bip32derivs */, psbtx, complete, nullptr);
422+
err = model->wallet().fillPSBT(SIGHASH_ALL, true /* sign */, true /* bip32derivs */, nullptr, psbtx, complete);
423423
} catch (const std::runtime_error& e) {
424424
QMessageBox::critical(nullptr, tr("Sign failed"), e.what());
425425
send_failure = true;

src/qt/walletmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
525525
if (create_psbt) {
526526
PartiallySignedTransaction psbtx(mtx);
527527
bool complete = false;
528-
const TransactionError err = wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, psbtx, complete, nullptr);
528+
const TransactionError err = wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, nullptr, psbtx, complete);
529529
if (err != TransactionError::OK || complete) {
530530
QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't draft transaction."));
531531
return false;

src/wallet/interfaces.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ class WalletImpl : public Wallet
349349
TransactionError fillPSBT(int sighash_type,
350350
bool sign,
351351
bool bip32derivs,
352+
size_t* n_signed,
352353
PartiallySignedTransaction& psbtx,
353-
bool& complete,
354-
size_t* n_signed) override
354+
bool& complete) override
355355
{
356356
return m_wallet->FillPSBT(psbtx, complete, sighash_type, sign, bip32derivs, n_signed);
357357
}

0 commit comments

Comments
 (0)