[#11674] Make sure token balances are fetched on mobile network

This commit is contained in:
Roman Volosovskyi 2021-01-28 18:04:36 +02:00
parent 781360a1cf
commit 00ad3e9e1f
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 17 additions and 16 deletions

View File

@ -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))
#{}

View File

@ -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?

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' 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"
}