mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-02-03 10:25:12 +00:00
[clock] Avoid crash when getBlock fails
This commit is contained in:
parent
3a8ce485e4
commit
83522e459c
@ -26,7 +26,8 @@ proc start*(clock: OnChainClock) {.async.} =
|
||||
let computerTime = getTime().toUnix
|
||||
clock.offset = blockTime - computerTime
|
||||
|
||||
onBlock(!await clock.provider.getBlock(BlockTag.latest))
|
||||
if latestBlock =? (await clock.provider.getBlock(BlockTag.latest)):
|
||||
onBlock(latestBlock)
|
||||
|
||||
clock.subscription = await clock.provider.subscribe(onBlock)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user