diff --git a/atomic_defi_design/Dex/Constants/General.qml b/atomic_defi_design/Dex/Constants/General.qml index 34c89b8fcf..2b269e21da 100644 --- a/atomic_defi_design/Dex/Constants/General.qml +++ b/atomic_defi_design/Dex/Constants/General.qml @@ -25,6 +25,14 @@ QtObject { function coinIcon(ticker) { + if (ticker.toLowerCase() == "smart chain") + { + return coin_icons_path + "smart_chain.png" + } + if (ticker.toLowerCase() == "avx") + { + return coin_icons_path + "avax.png" + } if (ticker === "" || ticker === "All" || ticker===undefined) { return "" @@ -458,7 +466,7 @@ QtObject { } if (sell_ticker_balance == 0) { - return qsTr("%1 balance is zero").arg(selectedTicker) + return qsTr("Balance is zero!") } if (!isZhtlcReady(selectedTicker)) { diff --git a/src/core/atomicdex/services/sync/timesync.checker.service.cpp b/src/core/atomicdex/services/sync/timesync.checker.service.cpp index 2909368a4e..8d539c84e8 100644 --- a/src/core/atomicdex/services/sync/timesync.checker.service.cpp +++ b/src/core/atomicdex/services/sync/timesync.checker.service.cpp @@ -44,11 +44,11 @@ namespace { using namespace std::string_literals; nlohmann::json resp; - bool sync_ok = false; + bool sync_ok = true; std::string resp_str = TO_STD_STR(resp_http.extract_string(true).get()); if (resp_http.status_code() != 200) { - SPDLOG_ERROR("Cannot reach the endpoint [{}]: {}", g_timesync_endpoint); + SPDLOG_ERROR("Cannot reach the endpoint [{}]: {}", g_timesync_endpoint, resp_str); } else { @@ -56,9 +56,10 @@ namespace int64_t epoch_ts = resp["unixtime"]; int64_t current_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); int64_t ts_diff = epoch_ts - current_ts; - if (abs(ts_diff) < 60) + if (abs(ts_diff) > 60) { - sync_ok = true; + SPDLOG_WARN("Time sync failed! Actual: {}, System: {}, Diff: {}", epoch_ts, current_ts, ts_diff); + sync_ok = false; } } return sync_ok; @@ -82,7 +83,7 @@ namespace atomic_dex int64_t m_timesync_clock_ts = std::chrono::duration_cast(m_timesync_clock.time_since_epoch()).count(); int64_t now_ts = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); int64_t ts_diff = now_ts - m_timesync_clock_ts; - if (abs(ts_diff) >= 60) + if (abs(ts_diff) > 300) { fetch_timesync_status(); m_timesync_clock = std::chrono::high_resolution_clock::now(); @@ -91,21 +92,28 @@ namespace atomic_dex void timesync_checker_service::fetch_timesync_status() { + SPDLOG_INFO("Checking system time is in sync..."); if (is_timesync_fetching) { + SPDLOG_WARN("Already checking timesync, returning"); return; } is_timesync_fetching = true; emit isTimesyncFetchingChanged(); async_fetch_timesync() .then([this](web::http::http_response resp) { - this->m_timesync_status = get_timesync_info_rpc(resp); - emit timesyncInfoChanged(); + bool is_timesync_ok = get_timesync_info_rpc(resp); + SPDLOG_INFO("System time is in sync: {}", is_timesync_ok); + + if (is_timesync_ok != *m_timesync_status) + { + this->m_timesync_status = is_timesync_ok; + emit timesyncInfoChanged(); + } }) .then(&handle_exception_pplx_task); is_timesync_fetching = false; emit isTimesyncFetchingChanged(); - } bool timesync_checker_service::get_timesync_info() const @@ -115,4 +123,5 @@ namespace atomic_dex } // namespace atomic_dex +