[#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]
{: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
[{:keys [db] :as cofx} historical? block-number accounts transactions-per-account]
(log/debug "[wallet-subs] new-block"
"accounts" accounts
"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
(cond-> {}
(not historical?)
@ -39,7 +45,7 @@
:addresses accounts
:before-block block-number
:historical? historical?}))
(transactions/check-watched-transactions)))
(transactions/check-watched-transactions))))
(fx/defn reorg
[{:keys [db] :as cofx} {:keys [blockNumber accounts]}]
@ -91,6 +97,7 @@
(case type
"newblock" (new-block cofx false blockNumber accounts newTransactions)
"history" (new-block cofx true blockNumber accounts nil)
"maxKnownBlock" (max-known-block cofx blockNumber)
"reorg" (reorg cofx event)
"recent-history-fetching" (recent-history-fetching-started cofx accounts)
"recent-history-ready" (recent-history-fetching-ended cofx event)