Skip to content

Commit

Permalink
https://github.com/mwcproject/mwc-qt-wallet/issues/856
Browse files Browse the repository at this point in the history
  • Loading branch information
bayk committed May 12, 2021
1 parent 428ebdc commit 6a067b2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions core/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const QString PAGE_S_SWAP_NEW = "Create Swap Trade";

const QString PAGE_S_MKT_LIST = "MWC Swap Marketplace";
const QString PAGE_S_MKT_NEW_OFFER = "Create new offer";
const QString PAGE_S_MKT_OFFER_UPDATE = "Offer update";
const QString PAGE_S_MKT_TX_FEE = "Integrity fee transactions";

const QString PAGE_U_NODE_STATUS = "MWC Node Status";
Expand Down
2 changes: 1 addition & 1 deletion core_desktop/DesktopWndManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ void DesktopWndManager::pageMarketplace(bool selectMyOffers, bool selectFee) {
}

void DesktopWndManager::pageNewUpdateOffer(QString myMsgId) {
windowManager->switchToWindowEx( mwc::PAGE_S_MKT_NEW_OFFER,
windowManager->switchToWindowEx( myMsgId.isEmpty() ? mwc::PAGE_S_MKT_NEW_OFFER : mwc::PAGE_S_MKT_OFFER_UPDATE,
new wnd::MrktSwapNew( windowManager->getInWndParent(), myMsgId));
}

Expand Down
9 changes: 5 additions & 4 deletions state/s_mktswap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,10 +1232,11 @@ void SwapMarketplace::onSendMarketplaceMessage(QString error, QString response,
if (core::WndManager::RETURN_CODE::BTN1 !=
core::getWndManager()->questionTextDlg(
"Warning",
"Wallet " + walletAddress + " already has " + QString::number(running_num) + " accepted trades. Only one trade that lock "
"coins first will continue, the rest will be cancelled. As a result your trade might be cancelled even you lock the coins.\n\n"
"You can wait for some time, try to accept this offer later. Or you can continue, you trade might win.\n\n "
"Do you want to continue and start trading?",
"There have been " + QString::number(running_num) + " acceptance" + (running_num>1 ? "s": "") + " to the offer from " + walletAddress +
". The offer will be rewarded to whichever wallet locks their funds first. As a result of this, "
"your trade may be cancelled (if you did not lock first) even though you have already locked your coins.\n\n"
"You can either wait and try to accept the offer later, or continue with this offer acceptance process in hope of winning.\n\n"
"Do you want to continue with the acceptance process?",
"Yes", "No",
"I understand the risk and I want to continue",
"No, I will better wait",
Expand Down
23 changes: 12 additions & 11 deletions state/s_swap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void Swap::onRequestTradeDetails( wallet::SwapTradeInfo swap,
"Please note:\n"
"There is a possibility that several peers may accept this offer at the same time. The offer will be awarded to whichever peer locks their funds first. "
"In this case, the winner will continue with the swap as usual; however, the other peers will receive a message stating that the offer has been dropped. "
"If you receive this message, do NOT deposit any coins to the lock account.";
"If you are notified that you offer has been dropped, do NOT deposit any coins to the lock account.";

}

Expand Down Expand Up @@ -747,13 +747,14 @@ void Swap::onSendMarketplaceMessage(QString error, QString response, QString off
if (running_num> mktRunningNum) {
// There are something already going, let's report it.
if ( core::WndManager::RETURN_CODE::BTN1 != core::getWndManager()->questionTextDlg("Warning",
"Wallet "+walletAddress+" already has " + QString::number(running_num) + " accepted trades. Only one trade that lock "
"coins first will continue, the rest will be cancelled. As a result your trade might be cancelled even you lock the coins.\n\n"
"You can wait for some time, try to accept this offer later. Or you can continue, you trade might win.\n\n "
"Do you want to continue and start trading?",
"Yes", "No",
"I understand the risk and I want to continue", "No, I will better wait",
false, true) )
"There have been multiple acceptances to the offer from " + walletAddress +
". The offer will be rewarded to whichever wallet locks their funds first. As a result of this, "
"your trade may be cancelled (if you did not lock first) even though you have already locked your coins.\n\n"
"You can either wait and try to accept the offer later, or continue with this offer acceptance process in hope of winning.\n\n"
"Do you want to continue with the acceptance process?",
"Yes", "No",
"I understand the risk and I want to continue", "No, I will better wait",
false, true) )
{
return;
}
Expand Down Expand Up @@ -1021,9 +1022,9 @@ void Swap::onRequestSwapTrades(QString cookie, QVector<wallet::SwapInfo> swapTra
core::getWndManager()->messageTextDlg("Warning", message);
}
else {
QString message = "Trade " + swap.swapId + " is dropped by your peer because there was several trades and another one locked the coins first.\n\n"
"Please don't deposit any coins to Locking account. After expiration time that trade will be cancelled automatically.\n"
"If you already lock your coins, please wait until your payment will be refuned.";
QString message = "Unfortunately someone else locked funds and accepted trade before you. Your trade " + swap.swapId + " will not go forward.\n\n"
"Please don't deposit any coins to the lock account. After the trade expiration time has passed, the trade will be cancelled automatically.\n\n"
"If you have already locked your coins, you will need to wait until your payment is refunded.";
core::getWndManager()->messageTextDlg("Warning", message);
}
return;
Expand Down
6 changes: 5 additions & 1 deletion windows_desktop/s_mrktswapnew_w.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ MrktSwapNew::MrktSwapNew(QWidget *parent, QString myMsgId) :
ui->secAddressEdit->setText( offer.secAddress );
ui->noteEdit->setText(offer.note);
secAddressCoin = offer.offer.secondaryCurrency;
ui->mwcBlocksEdit->setText(QString::number(offer.offer.mwcLockBlocks));
ui->secBlocksEdit->setText(QString::number(offer.offer.secLockBlocks));
}

if (!offer.offer.secondaryCurrency.isEmpty()) {
Expand Down Expand Up @@ -176,7 +178,9 @@ void MrktSwapNew::updateSecCurrencyStatus(bool seller) {
}

ui->secLockCurrencyLabel->setText(selectedCur);
ui->secBlocksEdit->setText( QString::number(swap->getSecConfNumber(selectedCur)) );
if ( offer.offer.id.isEmpty() ) {
ui->secBlocksEdit->setText( QString::number(swap->getSecConfNumber(selectedCur)) );
}
}

void MrktSwapNew::updateThirdValue() {
Expand Down

0 comments on commit 6a067b2

Please sign in to comment.