Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI][Bug] Notify transaction creation failure reason #1626

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/qt/pivx/guitransactionsutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ namespace GuiTransactionsUtils {
"Duplicate address found, can only send to each address once per send operation.");
break;
case WalletModel::TransactionCreationFailed:
retStr = parent->translate("Transaction creation failed!");
informType = CClientUIInterface::MSG_ERROR;
break;
case WalletModel::TransactionCommitFailed:
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/pivxgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ bool PIVXGUI::addWallet(const QString& name, WalletModel* walletModel)
}

// Connect actions..
connect(walletModel, &WalletModel::message, this, &PIVXGUI::message);
connect(masterNodesWidget, &MasterNodesWidget::message, this, &PIVXGUI::message);
connect(coldStakingWidget, &ColdStakingWidget::message, this, &PIVXGUI::message);
connect(topBar, &TopBar::message, this, &PIVXGUI::message);
Expand Down
8 changes: 6 additions & 2 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,12 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
if ((total + nFeeRequired) > nBalance) {
return SendCoinsReturn(AmountWithFeeExceedsBalance);
}
Q_EMIT message(tr("Send Coins"), QString::fromStdString(strFailReason),
CClientUIInterface::MSG_ERROR);

Q_EMIT message(tr("Send Coins"), tr("Transaction creation failed!\n%1").arg(
strFailReason == "Transaction too large" ?
random-zebra marked this conversation as resolved.
Show resolved Hide resolved
tr("The size of the transaction is too big.\nSelect fewer inputs with coin control.") :
QString::fromStdString(strFailReason)),
CClientUIInterface::MSG_ERROR);
return TransactionCreationFailed;
}

Expand Down
4 changes: 2 additions & 2 deletions src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class WalletModel : public QObject
AmountExceedsBalance,
AmountWithFeeExceedsBalance,
DuplicateAddress,
TransactionCreationFailed, // Error returned when wallet is still locked
TransactionCreationFailed,
TransactionCommitFailed,
StakingOnlyUnlocked,
InsaneFee,
Expand Down Expand Up @@ -360,7 +360,7 @@ class WalletModel : public QObject
void requireUnlock();

// Fired when a message should be reported to the user
void message(const QString& title, const QString& message, unsigned int style);
void message(const QString& title, const QString& body, unsigned int style, bool* ret = nullptr);

// Coins sent: from wallet, to recipient, in (serialized) transaction:
void coinsSent(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction);
Expand Down