ChainReorganisationResolution

Documentation for eth_defi.event_reader.reorganisation_monitor.ChainReorganisationResolution Python class.

class ChainReorganisationResolution[source]

How did we fare getting hashes and timestamps for the latest blocks.

Attributes summary

last_live_block

What we know is the chain tip on our node

latest_block_with_good_data

What we know is the block for which we do not need to perform rollback

reorg_detected

Did we detect any reorgs in this chycle

Methods summary

__init__(last_live_block, ...)

get_read_range()

Get the range of blocks we should read on this poll cycle.

last_live_block: int

What we know is the chain tip on our node

This is the latest block at the JSON-RPC node. We can read data up to this block.

latest_block_with_good_data: int

What we know is the block for which we do not need to perform rollback

This is the block number that does not need to purged from your internal database. All previously read events that have higher block number should be purged.

reorg_detected: bool

Did we detect any reorgs in this chycle

get_read_range()[source]

Get the range of blocks we should read on this poll cycle.

  • This range may overlap your previous event read range.

  • You should discard any data that’s older than the start of the range

  • You should be prepared to read an event again

Returns

(start block, end block) inclusive range

Return type

Tuple[int, int]

__init__(last_live_block, latest_block_with_good_data, reorg_detected)
Parameters
  • last_live_block (int) –

  • latest_block_with_good_data (int) –

  • reorg_detected (bool) –

Return type

None