Skip to content

Commit bf72bea

Browse files
fanquakePastaPastaPasta
authored andcommitted
Merge bitcoin#22214: refactor: Rearrange fillPSBT arguments
f47e802 Rearrange fillPSBT arguments (Russell Yanofsky) Pull request description: Move fillPSBT inout argument before output-only arguments. This is a nice thing to do to keep the interface style [consistent](https://google.github.io/styleguide/cppguide.html#Inputs_and_Outputs). But motivation is to work around a current limitation of the libmultiprocess code generator (which figures out order of inout parameters by looking at input list, but more ideally would use the output list). --- This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10). The commit was first part of larger PR bitcoin#10102. ACKs for top commit: achow101: ACK f47e802 theStack: Code-review ACK f47e802 Tree-SHA512: 1787af3031ff7ed6b519f3b93054d8b257af96a3380a476a6dab0f759329039ecc5d624b785c5c2d14d594fc852dd81c626880c775c691ec9c79b7b3dbcfb257
1 parent 1fc62c8 commit bf72bea

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/interfaces/wallet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ class Wallet
206206
virtual TransactionError fillPSBT(int sighash_type,
207207
bool sign,
208208
bool bip32derivs,
209+
size_t* n_signed,
209210
PartiallySignedTransaction& psbtx,
210-
bool& complete,
211-
size_t* n_signed) = 0;
211+
bool& complete) = 0;
212212

213213
//! Get balances.
214214
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
487487
CMutableTransaction mtx = CMutableTransaction{*(m_current_transaction->getWtx())};
488488
PartiallySignedTransaction psbtx(mtx);
489489
bool complete = false;
490-
const TransactionError err = model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, psbtx, complete, nullptr);
490+
const TransactionError err = model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, nullptr, psbtx, complete);
491491
assert(!complete);
492492
assert(err == TransactionError::OK);
493493
// Serialize the PSBT

src/wallet/interfaces.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ class WalletImpl : public Wallet
367367
TransactionError fillPSBT(int sighash_type,
368368
bool sign,
369369
bool bip32derivs,
370+
size_t* n_signed,
370371
PartiallySignedTransaction& psbtx,
371-
bool& complete,
372-
size_t* n_signed) override
372+
bool& complete) override
373373
{
374374
return m_wallet->FillPSBT(psbtx, complete, sighash_type, sign, bip32derivs, n_signed);
375375
}

0 commit comments

Comments
 (0)