I am trying to build a bot that listens to events on AMMs for various chains and I am running into issues when trying to build out my algorithm for the avalanche network. When calling the getLogs
function for a particular event, the program will randomly crash with the following error
ValueError: {'code': -32000, 'message': 'requested to block ... after last accepted block ...'}
My program is only ever retrieves logs up to the latest
block so I am not sure why this error is occurring (I assume it has something to do with the way avax nodes reach consensus).
How can I verify if a block is accepted prior to running getLogs
?