eth-watcher: be quieter about parse errors

This commit is contained in:
Philip Monk 2019-12-04 17:58:00 -08:00
parent 73cffdb28f
commit b51eda4f1e
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
3 changed files with 14 additions and 12 deletions

View File

@ -124,6 +124,7 @@
=. url.state url.poke
[[(start state [our dap]:bowl) ~] this]
==
::
++ on-watch
|= =path
^- (quip card:agent:gall _this)

View File

@ -398,7 +398,6 @@
++ thread-fail
|= [=yarn =term =tang]
^- (quip card ^state)
%- (slog leaf+"strand {<yarn>} failed" leaf+<term> tang)
=/ =tid (yarn-to-tid yarn)
=/ fail-cards (thread-say-fail tid term tang)
=^ cards state (thread-clean yarn)

View File

@ -126,28 +126,30 @@
=/ m (strand:strandio ,block)
^- form:m
|^
%+ (retry:strandio ,block) `10
=/ m (strand:strandio ,(unit block))
^- form:m
;< =json bind:m
%+ request-rpc url
:- `'block by number'
[%eth-get-block-by-number number |]
=/ =block (parse-block json)
?. =(number number.id.block)
(strand-fail:strandio %reorg-detected >number< >block< ~)
(pure:m block)
(pure:m (parse-block json))
::
++ parse-block
|= =json
^- block
=< [[&1 &2] |2]
^- [@ @ @]
^- (unit block)
=< ?~(. ~ `[[&1 &2] |2]:u)
^- (unit [@ @ @])
~| json
%. json
=, dejs:format
=, dejs-soft:format
%- ot
:~ hash+parse-hex-result:rpc:ethereum
number+parse-hex-result:rpc:ethereum
'parentHash'^parse-hex-result:rpc:ethereum
:~ hash+parse-hex
number+parse-hex
'parentHash'^parse-hex
==
::
++ parse-hex |=(=json `(unit @)`(some (parse-hex-result:rpc:ethereum json)))
--
::
++ get-logs-by-hash