From 00ad3e9e1f913dcf67187f640fc5baa2578fa458 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 28 Jan 2021 18:04:36 +0200 Subject: [PATCH] [#11674] Make sure token balances are fetched on mobile network --- src/status_im/ethereum/transactions/core.cljs | 8 +++----- src/status_im/wallet/core.cljs | 19 +++++++++++-------- status-go-version.json | 6 +++--- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/status_im/ethereum/transactions/core.cljs b/src/status_im/ethereum/transactions/core.cljs index 331b10eb69..b22d4de37e 100644 --- a/src/status_im/ethereum/transactions/core.cljs +++ b/src/status_im/ethereum/transactions/core.cljs @@ -228,12 +228,10 @@ "count" (count transfers) "limit" limit) (let [checksum (eip55/address->checksum address) - max-known-block (or (get-max-block-with-transfers db address) - 0) + max-known-block (get-max-block-with-transfers db address) effects (cond-> [(when (seq transfers) (set-lowest-fetched-block checksum transfers)) - (when (seq transfers) - (set-max-block-with-transfers checksum transfers))] + (set-max-block-with-transfers checksum transfers)] (seq transfers) (concat (mapv add-transfer transfers)) @@ -247,7 +245,7 @@ true (conj (wallet/update-balances (into [] (reduce (fn [acc {:keys [address block]}] - (if (> block max-known-block) + (if (and max-known-block (> block max-known-block)) (conj acc address) acc)) #{} diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index d973b5a2af..8c012f383c 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -232,7 +232,8 @@ (reduce (fn [acc {:keys [address symbol]}] (assoc acc address symbol)) {}))] - (when (not= network-status :offline) + (when (and (seq addresses) + (not= network-status :offline)) (fx/merge cofx {:wallet/get-balances addresses @@ -564,16 +565,18 @@ (fx/defn stop-wallet [{:keys [db] :as cofx}] - (let [state (get db :wallet-service/state) - old-timeout (get db :wallet-service/restart-timeout) - timeout (or - old-timeout - (utils.utils/set-timeout - #(re-frame.core/dispatch [::restart]) - (get-restart-interval db)))] + (let [state (get db :wallet-service/state) + old-timeout (get db :wallet-service/restart-timeout) + timeout (or + old-timeout + (utils.utils/set-timeout + #(re-frame.core/dispatch [::restart]) + (get-restart-interval db))) + max-known-block (get db :wallet/max-known-block 0)] {:db (-> db (update :wallet dissoc :fetching) (assoc :wallet-service/state :stopped) + (assoc :wallet/max-known-block max-known-block) (assoc :wallet-service/restart-timeout timeout) (dissoc :wallet/recent-history-fetching-started? :wallet/waiting-for-recent-history? diff --git a/status-go-version.json b/status-go-version.json index 7bed4b72cd..cbbed34999 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.69.2", - "commit-sha1": "ee8f333dbfd60f279336723d2f74a20b91ae642b", - "src-sha256": "1hg0rx09nym1lc8ngvhvlbmsimyfjq8r6xd0fb7h946v0vjb461g" + "version": "v0.69.3", + "commit-sha1": "e18050b87f75b09cd8ad8451a7d7e0fa2e498654", + "src-sha256": "01s1s91afy2bwlx928b62fw4fc6mvsphz2py1sfc0fl9r7dw1lkz" }