From cc520a1f27d5cda141430c94d2abf317204770be Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Tue, 3 Mar 2020 15:48:51 +0200 Subject: [PATCH] [#9987] Stop fetching new blocks while app is not active --- src/status_im/ethereum/transactions/core.cljs | 15 +++++++++------ status-go-version.json | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/status_im/ethereum/transactions/core.cljs b/src/status_im/ethereum/transactions/core.cljs index a739b10eff..e4e4d95634 100644 --- a/src/status_im/ethereum/transactions/core.cljs +++ b/src/status_im/ethereum/transactions/core.cljs @@ -210,23 +210,26 @@ (fx/defn new-transfers {:events [::new-transfers]} - [{:keys [db] :as cofx} transfers {:keys [address historical? limit]}] + [{:keys [db] :as cofx} transfers {:keys [address limit]}] (log/debug "[transfers] new-transfers" "address" address "count" (count transfers) "limit" limit) (let [checksum (eip55/address->checksum address) + min-known-block (or (get-min-known-block db address) + (:ethereum/current-block db)) effects (cond-> [(when (seq transfers) (set-lowest-fetched-block checksum transfers))] (seq transfers) (concat (mapv add-transfer transfers)) - ;;NOTE: we only update the balance for new transfers and not - ;; historical ones - (not historical?) + + true (conj (wallet/update-balances - (into [] (reduce (fn [acc {:keys [address]}] - (conj acc address)) + (into [] (reduce (fn [acc {:keys [address block]}] + (if (> block min-known-block) + (conj acc address) + acc)) #{} transfers)))) diff --git a/status-go-version.json b/status-go-version.json index 13d1a05de0..69fcceae43 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.48.3", - "commit-sha1": "7be1fcb978ad3a640b9eb6372eea4caf4e1bfb03", - "src-sha256": "100dls7fcddcfziw1rhdb2aaj0lpwi2ri6bnr503sxbjaac1zmnb" + "version": "v0.48.8", + "commit-sha1": "d1beb4c76d9fabcd00da75ad63430104f92c1404", + "src-sha256": "0sx85hg5c1dap2cnf44kqgp0lbknl4wd3n47cchiivnlmv4c9gw8" }