[qt] Return useful error message on ATMP failure
This commit is contained in:
parent
d2143dc937
commit
3333e5a1e5
3 changed files with 8 additions and 4 deletions
|
@ -534,7 +534,7 @@ void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn
|
||||||
msgParams.second = CClientUIInterface::MSG_ERROR;
|
msgParams.second = CClientUIInterface::MSG_ERROR;
|
||||||
break;
|
break;
|
||||||
case WalletModel::TransactionCommitFailed:
|
case WalletModel::TransactionCommitFailed:
|
||||||
msgParams.first = tr("The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
|
msgParams.first = tr("The transaction was rejected with the following reason: %1").arg(sendCoinsReturn.reasonCommitFailed);
|
||||||
msgParams.second = CClientUIInterface::MSG_ERROR;
|
msgParams.second = CClientUIInterface::MSG_ERROR;
|
||||||
break;
|
break;
|
||||||
case WalletModel::AbsurdFee:
|
case WalletModel::AbsurdFee:
|
||||||
|
|
|
@ -331,7 +331,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
|
||||||
CReserveKey *keyChange = transaction.getPossibleKeyChange();
|
CReserveKey *keyChange = transaction.getPossibleKeyChange();
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
if(!wallet->CommitTransaction(*newTx, *keyChange, g_connman.get(), state))
|
if(!wallet->CommitTransaction(*newTx, *keyChange, g_connman.get(), state))
|
||||||
return TransactionCommitFailed;
|
return SendCoinsReturn(TransactionCommitFailed, QString::fromStdString(state.GetRejectReason()));
|
||||||
|
|
||||||
CTransaction* t = (CTransaction*)newTx;
|
CTransaction* t = (CTransaction*)newTx;
|
||||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
|
|
|
@ -144,9 +144,13 @@ public:
|
||||||
// Return status record for SendCoins, contains error id + information
|
// Return status record for SendCoins, contains error id + information
|
||||||
struct SendCoinsReturn
|
struct SendCoinsReturn
|
||||||
{
|
{
|
||||||
SendCoinsReturn(StatusCode _status = OK):
|
SendCoinsReturn(StatusCode _status = OK, QString _reasonCommitFailed = "")
|
||||||
status(_status) {}
|
: status(_status),
|
||||||
|
reasonCommitFailed(_reasonCommitFailed)
|
||||||
|
{
|
||||||
|
}
|
||||||
StatusCode status;
|
StatusCode status;
|
||||||
|
QString reasonCommitFailed;
|
||||||
};
|
};
|
||||||
|
|
||||||
// prepare transaction for getting txfee before sending coins
|
// prepare transaction for getting txfee before sending coins
|
||||||
|
|
Loading…
Reference in a new issue