btc-provider: ping _only_ once every 30 seconds
?- -.comm
%set-credentials
:_ state(host-info [api-url.comm %.n network.comm 0 *(set ship)])
- :~ do-ping:hc
- (start-ping-timer:hc ~s30)
- ==
+ ~[(start-ping-timer:hc ~s30)]
::
%add-whitelist
:- ~
?. (is-whitelisted:hc src.bowl)
~|("btc-provider: blocked client {<src.bowl>}" !!)
~& > "btc-provider: accepted client {<src.bowl>}"
- :- [do-ping:hc]~
- this(clients.host-info (~(put in clients.host-info) src.bowl))
+ `this(clients.host-info (~(put in clients.host-info) src.bowl))
::
++ on-arvo
~/ %on-arvo
::
?: ?=([%ping-timer *] wir)
:_ this
- :~ do-ping:hc
+ :~ do-ping
(start-ping-timer:hc ~s30)
==
=^ cards state
==
[cards this]
::
+ ++ do-ping
+ ^- card
+ =/ act=action [%ping ~]
+ :* %pass /ping/[(scot %da now.bowl)] %agent
+ [our.bowl %btc-provider] %poke
+ %btc-provider-action !>(act)
+ ==
+ ::
:: Handles HTTP responses from RPC servers. Parses for errors,
:: then handles response. For actions that require collating multiple
:: RPC calls, uses req-card to call out to RPC again if more
|= interval=@dr
^- card
[%pass /ping-timer %arvo %b %wait (add now.bowl interval)]
-::
-++ do-ping
- ^- card
- =/ act=action [%ping ~]
- :* %pass /ping/[(scot %da now.bowl)] %agent
- [our.bowl %btc-provider] %poke
- %btc-provider-action !>(act)
- ==
--
