Skip to content

Commit 9ef180a

Browse files
committed
Merge #608: wallet, refactor: Make WalletModel::sendCoins() return void
1f653dc qt, wallet, refactor: Make `WalletModel::sendCoins()` return `void` (Hennadii Stepanov) Pull request description: Currently, the `WalletModel::sendCoins()` function always returns the same value. Also dead and noop (calling `processSendCoinsReturn(OK)`) code has been removed. The other `return` statements have been removed from the `WalletModel::sendCoins()` function in bitcoin/bitcoin#17154 and bitcoin/bitcoin#17165. ACKs for top commit: kristapsk: cr ACK 1f653dc furszy: Code review ACK 1f653dc shaavan: Code Review ACK 1f653dc w0xlt: Code Review ACK 1f653dc Tree-SHA512: 2b59495a7fc10b4de30fcc63fc3af92d50406e16031112eb72494736dce193ac1fbac0802623496cf81edcd16766e1647d9c4f3a607b3eb84cc50e273b999c04
2 parents b71d37d + 1f653dc commit 9ef180a

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -543,15 +543,8 @@ void SendCoinsDialog::sendButtonClicked([[maybe_unused]] bool checked)
543543
// failed, or more signatures are needed.
544544
if (broadcast) {
545545
// now send the prepared transaction
546-
WalletModel::SendCoinsReturn sendStatus = model->sendCoins(*m_current_transaction);
547-
// process sendStatus and on error generate message shown to user
548-
processSendCoinsReturn(sendStatus);
549-
550-
if (sendStatus.status == WalletModel::OK) {
551-
Q_EMIT coinsSent(m_current_transaction->getWtx()->GetHash());
552-
} else {
553-
send_failure = true;
554-
}
546+
model->sendCoins(*m_current_transaction);
547+
Q_EMIT coinsSent(m_current_transaction->getWtx()->GetHash());
555548
}
556549
}
557550
if (!send_failure) {

src/qt/walletmodel.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
234234
return SendCoinsReturn(OK);
235235
}
236236

237-
WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &transaction)
237+
void WalletModel::sendCoins(WalletModelTransaction& transaction)
238238
{
239239
QByteArray transaction_array; /* store serialized transaction */
240240

@@ -280,8 +280,6 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
280280
}
281281

282282
checkBalanceChanged(m_wallet->getBalances()); // update balance immediately, otherwise there could be a short noticeable delay until pollBalanceChanged hits
283-
284-
return SendCoinsReturn(OK);
285283
}
286284

287285
OptionsModel* WalletModel::getOptionsModel() const

src/qt/walletmodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class WalletModel : public QObject
102102
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const wallet::CCoinControl& coinControl);
103103

104104
// Send coins to a list of recipients
105-
SendCoinsReturn sendCoins(WalletModelTransaction &transaction);
105+
void sendCoins(WalletModelTransaction& transaction);
106106

107107
// Wallet encryption
108108
bool setWalletEncrypted(const SecureString& passphrase);

0 commit comments

Comments
 (0)