[#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) "count" (count transfers)
"limit" limit) "limit" limit)
(let [checksum (eip55/address->checksum address) (let [checksum (eip55/address->checksum address)
max-known-block (or (get-max-block-with-transfers db address) max-known-block (get-max-block-with-transfers db address)
0)
effects (cond-> [(when (seq transfers) effects (cond-> [(when (seq transfers)
(set-lowest-fetched-block checksum 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) (seq transfers)
(concat (mapv add-transfer transfers)) (concat (mapv add-transfer transfers))
@ -247,7 +245,7 @@
true true
(conj (wallet/update-balances (conj (wallet/update-balances
(into [] (reduce (fn [acc {:keys [address block]}] (into [] (reduce (fn [acc {:keys [address block]}]
(if (> block max-known-block) (if (and max-known-block (> block max-known-block))
(conj acc address) (conj acc address)
acc)) acc))
#{} #{}

View File

@ -232,7 +232,8 @@
(reduce (fn [acc {:keys [address symbol]}] (reduce (fn [acc {:keys [address symbol]}]
(assoc acc address symbol)) (assoc acc address symbol))
{}))] {}))]
(when (not= network-status :offline) (when (and (seq addresses)
(not= network-status :offline))
(fx/merge (fx/merge
cofx cofx
{:wallet/get-balances addresses {:wallet/get-balances addresses
@ -570,10 +571,12 @@
old-timeout old-timeout
(utils.utils/set-timeout (utils.utils/set-timeout
#(re-frame.core/dispatch [::restart]) #(re-frame.core/dispatch [::restart])
(get-restart-interval db)))] (get-restart-interval db)))
max-known-block (get db :wallet/max-known-block 0)]
{:db (-> db {:db (-> db
(update :wallet dissoc :fetching) (update :wallet dissoc :fetching)
(assoc :wallet-service/state :stopped) (assoc :wallet-service/state :stopped)
(assoc :wallet/max-known-block max-known-block)
(assoc :wallet-service/restart-timeout timeout) (assoc :wallet-service/restart-timeout timeout)
(dissoc :wallet/recent-history-fetching-started? (dissoc :wallet/recent-history-fetching-started?
:wallet/waiting-for-recent-history? :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", "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.69.2", "version": "v0.69.3",
"commit-sha1": "ee8f333dbfd60f279336723d2f74a20b91ae642b", "commit-sha1": "e18050b87f75b09cd8ad8451a7d7e0fa2e498654",
"src-sha256": "1hg0rx09nym1lc8ngvhvlbmsimyfjq8r6xd0fb7h946v0vjb461g" "src-sha256": "01s1s91afy2bwlx928b62fw4fc6mvsphz2py1sfc0fl9r7dw1lkz"
} }