eth-watcher: ensure logs always sent oldest-first

For easier "this happened, then that happened" on the client side.
This commit is contained in:
Fang 2019-10-30 18:44:34 +01:00
parent e0b564f72f
commit 555eae6e25
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
2 changed files with 8 additions and 4 deletions

View File

@ -19,6 +19,7 @@
blocks=(list block)
==
::
:: history: newest block first, oldest event first
+$ history (list loglist)
+$ pending-logs (map number:block loglist)
::
@ -278,7 +279,7 @@
(rewind [path dog] block)
;< [=new=pending-logs =released=loglist] bind:m
(release-old-events path pending-logs.dog number.id.block)
;< =new=loglist bind:m
;< =new=loglist bind:m :: oldest first
(get-logs-by-hash url.dog hash.id.block contracts.dog topics.dog)
=. new-pending-logs
(~(put by new-pending-logs) number.id.block new-loglist)
@ -360,7 +361,7 @@
?: (lth latest-number (add number.dog zoom-margin))
(pure:m dog)
=/ to-number=number:block (sub latest-number zoom-margin)
;< =loglist bind:m
;< =loglist bind:m :: oldest first
%: get-logs-by-range
url.dog
contracts.dog
@ -461,7 +462,10 @@
:+ %diff %eth-watcher-diff
:- %history
^- loglist
(zing history:(~(gut by dogs.state) t.path *watchdog))
%- zing
%- flop
=< history
(~(gut by dogs.state) t.path *watchdog)
(pure:m state)
::
:: +handle-peek: get diagnostics data

View File

@ -22,7 +22,7 @@
==
::
+$ diff
$% :: %history: full event log history
$% :: %history: full event log history, oldest first
::
[%history =loglist]
:: %log: newly added log