Skip to content

Commit

Permalink
migrate eth_syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
advaita-saha committed Feb 11, 2025
1 parent ec66a75 commit 4a15594
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions nimbus/rpc/server_api.nim
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,16 @@ proc setupServerAPI*(api: ServerAPIRef, server: RpcServer, ctx: EthContext) =

server.rpc("eth_syncing") do() -> SyncingStatus:
## Returns SyncObject or false when not syncing.
if api.com.syncState != Waiting:
let (start, current, target) = api.com.beaconSyncerProgress()
if start == 0 and current == 0 and target == 0:
return SyncingStatus(syncing: false)
else:
let sync = SyncObject(
startingBlock: Quantity(api.com.syncStart),
currentBlock: Quantity(api.com.syncCurrent),
highestBlock: Quantity(api.com.syncHighest),
startingBlock: Quantity(start),
currentBlock: Quantity(current),
highestBlock: Quantity(target),
)
return SyncingStatus(syncing: true, syncObject: sync)
else:
return SyncingStatus(syncing: false)

proc getLogsForBlock(
chain: ForkedChainRef, header: Header, opts: FilterOptions
Expand Down

0 comments on commit 4a15594

Please sign in to comment.