nimbus-eth2/beacon_chain/mainchain_monitor.nim

30 lines
960 B
Nim
Raw Normal View History

2018-11-26 13:33:06 +00:00
import
2018-11-29 01:08:34 +00:00
asyncdispatch2, json_rpc/rpcclient,
spec/[datatypes, digest]
2018-11-26 13:33:06 +00:00
type
MainchainMonitor* = object
gethAddress: string
gethPort: Port
proc init*(T: type MainchainMonitor, gethAddress: string, gethPort: Port): T =
result.gethAddress = gethAddress
result.gethPort = gethPort
proc start*(m: var MainchainMonitor) =
# TODO
# Start an async loop following the new blocks using the ETH1 JSON-RPC
# interface and keep an always-up-to-date receipt reference here
discard
2018-11-29 01:08:34 +00:00
proc getBeaconBlockRef*(m: MainchainMonitor): Eth2Digest =
2018-11-26 13:33:06 +00:00
# This should be a simple accessor for the reference kept above
discard
2018-11-29 01:08:34 +00:00
iterator getValidatorActions*(m: MainchainMonitor,
fromBlock, toBlock: Eth2Digest): SpecialRecord =
2018-11-26 13:33:06 +00:00
# It's probably better if this doesn't return a SpecialRecord, but
# rather a more readable description of the change that can be packed
# in a SpecialRecord by the client of the API.
discard