3
监听合约事件时出现filter not found错误
source link: https://learnblockchain.cn/question/2908
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
监听合约事件时出现filter not found错误
监听合约事件时出现filter not found错误
def listenEvent(self):
eventFilter = self.saleNewContract.events.SellPlayer.createFilter(fromBlock='latest')
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(
asyncio.gather(
self.logLoop(eventFilter, 0.5)
)
)
async def logLoop(self, eventFilter, pollInterval):
while True:
try:
events = eventFilter.get_new_entries()
for event in events:
self.handleEvent(event)
await asyncio.sleep(pollInterval)
except ValueError as e:
print(e)
continue
运行一段时间后出现错误:
valueerror: {'code': -32000, 'message': 'filter not found'}
我看了下,是eventFilter
这个空了,所以才出错,找不到filter。推测是一段时间后没检测到最新的事件就会出错?
各位大佬知道怎么解决吗?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK