[#11507] Fix e2e tests

This commit is contained in:
Roman Volosovskyi 2020-12-04 18:10:29 +02:00
parent 2f1e5c819e
commit 7055c46a60
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 21 additions and 14 deletions

View File

@ -20,12 +20,18 @@
[{:keys [db]} id handler] [{:keys [db]} id handler]
{:db (assoc-in db [:ethereum/subscriptions id] handler)}) {:db (assoc-in db [:ethereum/subscriptions id] handler)})
(fx/defn max-known-block
[{:keys [db]} block-number]
{:db (assoc db :wallet/max-known-block block-number)})
(fx/defn new-block (fx/defn new-block
[{:keys [db] :as cofx} historical? block-number accounts transactions-per-account] [{:keys [db] :as cofx} historical? block-number accounts transactions-per-account]
(log/debug "[wallet-subs] new-block" (log/debug "[wallet-subs] new-block"
"accounts" accounts "accounts" accounts
"block" block-number "block" block-number
"transactions-per-account" transactions-per-account) "transactions-per-account" transactions-per-account
"max-known-block" (:wallet/max-known-block db))
(when (>= block-number (:wallet/max-known-block db))
(fx/merge cofx (fx/merge cofx
(cond-> {} (cond-> {}
(not historical?) (not historical?)
@ -39,7 +45,7 @@
:addresses accounts :addresses accounts
:before-block block-number :before-block block-number
:historical? historical?})) :historical? historical?}))
(transactions/check-watched-transactions))) (transactions/check-watched-transactions))))
(fx/defn reorg (fx/defn reorg
[{:keys [db] :as cofx} {:keys [blockNumber accounts]}] [{:keys [db] :as cofx} {:keys [blockNumber accounts]}]
@ -91,6 +97,7 @@
(case type (case type
"newblock" (new-block cofx false blockNumber accounts newTransactions) "newblock" (new-block cofx false blockNumber accounts newTransactions)
"history" (new-block cofx true blockNumber accounts nil) "history" (new-block cofx true blockNumber accounts nil)
"maxKnownBlock" (max-known-block cofx blockNumber)
"reorg" (reorg cofx event) "reorg" (reorg cofx event)
"recent-history-fetching" (recent-history-fetching-started cofx accounts) "recent-history-fetching" (recent-history-fetching-started cofx accounts)
"recent-history-ready" (recent-history-fetching-ended cofx event) "recent-history-ready" (recent-history-fetching-ended cofx event)