Skip to content

Commit 1f653dc

Browse files
committed
qt, wallet, refactor: Make WalletModel::sendCoins() return void
Currently, the `WalletModel::sendCoins()` function always returns the same value. Also dead and noop code has been removed.
1 parent ba48fcf commit 1f653dc

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
@@ -103,7 +103,7 @@ class WalletModel : public QObject
103103
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const wallet::CCoinControl& coinControl);
104104

105105
// Send coins to a list of recipients
106-
SendCoinsReturn sendCoins(WalletModelTransaction &transaction);
106+
void sendCoins(WalletModelTransaction& transaction);
107107

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

0 commit comments

Comments
 (0)