From 6a067b2c7d5d60c0cce6c4a02fcbc927a56a12d9 Mon Sep 17 00:00:00 2001 From: bayk Date: Wed, 12 May 2021 15:55:40 -0700 Subject: [PATCH] https://github.com/mwcproject/mwc-qt-wallet/issues/856 --- core/global.h | 1 + core_desktop/DesktopWndManager.cpp | 2 +- state/s_mktswap.cpp | 9 +++++---- state/s_swap.cpp | 23 ++++++++++++----------- windows_desktop/s_mrktswapnew_w.cpp | 6 +++++- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/core/global.h b/core/global.h index 36b78682..0b50e147 100755 --- a/core/global.h +++ b/core/global.h @@ -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"; diff --git a/core_desktop/DesktopWndManager.cpp b/core_desktop/DesktopWndManager.cpp index 8ccd8406..f3b22d34 100644 --- a/core_desktop/DesktopWndManager.cpp +++ b/core_desktop/DesktopWndManager.cpp @@ -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)); } diff --git a/state/s_mktswap.cpp b/state/s_mktswap.cpp index 15083c92..a7592da8 100644 --- a/state/s_mktswap.cpp +++ b/state/s_mktswap.cpp @@ -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", diff --git a/state/s_swap.cpp b/state/s_swap.cpp index eda96d27..18ab7e8b 100644 --- a/state/s_swap.cpp +++ b/state/s_swap.cpp @@ -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."; } @@ -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; } @@ -1021,9 +1022,9 @@ void Swap::onRequestSwapTrades(QString cookie, QVector 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; diff --git a/windows_desktop/s_mrktswapnew_w.cpp b/windows_desktop/s_mrktswapnew_w.cpp index 1d7db83f..4178d2eb 100644 --- a/windows_desktop/s_mrktswapnew_w.cpp +++ b/windows_desktop/s_mrktswapnew_w.cpp @@ -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()) { @@ -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() {