Merge #17154: wallet: Remove return value from CommitTransaction
9e95931865[wallet] Remove `state` argument from CWallet::CommitTransaction (John Newbery)d1734f9a3b[wallet] Remove return value from CommitTransaction() (John Newbery)b6f486a02b[wallet] Add doxygen comment to CWallet::CommitTransaction() (John Newbery)8bba91b22d[wallet] Fix whitespace in CWallet::CommitTransaction() (John Newbery) Pull request description: `CommitTransaction()` returns a bool to indicate success, but since commitb3a7410(#9302) it only returns true, even if the transaction was not successfully broadcast. This commit changes CommitTransaction() to return void. All dead code in `if (!CommitTransaction())` branches has been removed. Two additional commits fix up the idiosyncratic whitespace in `CommitTransaction` and add a doxygen comment for the function. ACKs for top commit: laanwj: ACK9e95931865Tree-SHA512: a55a2c20369a45222fc0e02d0891495655a926e71c4f52cb72624768dd7b9c1dca716ea67d38420afb90f40c6e0fd448caa60c18fd693bb10ecb110b641820e6
This commit is contained in:
10 files changed
+54
-92
No files matched your search
@@ -558,8 +558,7 @@ void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn
|
||||
msgParams.second = CClientUIInterface::MSG_WARNING;
|
||||
|
||||
// This comment is specific to SendCoinsDialog usage of WalletModel::SendCoinsReturn.
|
||||
// WalletModel::TransactionCommitFailed is used only in WalletModel::sendCoins()
|
||||
// all others are used only in WalletModel::prepareTransaction()
|
||||
// All status values are used only in WalletModel::prepareTransaction()
|
||||
switch(sendCoinsReturn.status)
|
||||
{
|
||||
case WalletModel::InvalidAddress:
|
||||
@@ -581,10 +580,6 @@ void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn
|
||||
msgParams.first = tr("Transaction creation failed!");
|
||||
msgParams.second = CClientUIInterface::MSG_ERROR;
|
||||
break;
|
||||
case WalletModel::TransactionCommitFailed:
|
||||
msgParams.first = tr("The transaction was rejected with the following reason: %1").arg(sendCoinsReturn.reasonCommitFailed);
|
||||
msgParams.second = CClientUIInterface::MSG_ERROR;
|
||||
break;
|
||||
case WalletModel::AbsurdFee:
|
||||
msgParams.first = tr("A fee higher than %1 is considered an absurdly high fee.").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->wallet().getDefaultMaxTxFee()));
|
||||
break;
|
||||
|
||||
@@ -260,9 +260,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
|
||||
}
|
||||
|
||||
auto& newTx = transaction.getWtx();
|
||||
std::string rejectReason;
|
||||
if (!wallet().commitTransaction(newTx, {} /* mapValue */, std::move(vOrderForm), rejectReason))
|
||||
return SendCoinsReturn(TransactionCommitFailed, QString::fromStdString(rejectReason));
|
||||
wallet().commitTransaction(newTx, {} /* mapValue */, std::move(vOrderForm));
|
||||
|
||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssTx << *newTx;
|
||||
|
||||
@@ -138,7 +138,6 @@ public:
|
||||
AmountWithFeeExceedsBalance,
|
||||
DuplicateAddress,
|
||||
TransactionCreationFailed, // Error returned when wallet is still locked
|
||||
TransactionCommitFailed,
|
||||
AbsurdFee,
|
||||
PaymentRequestExpired
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user