cic-sync-filter/cic_sync_filter/base.py

18 lines
422 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class SyncFilter:
def __init__(self):
self.exec_count = 0
self.match_count = 0
def filter(self, conn, block, tx, db_session):
self.exec_count += 1
def register_match(self):
self.match_count += 1
def to_logline(self, block, tx, v):
return '{} exec {} match {} block {} tx {}: {}'.format(self, self.exec_count, self.match_count, block.number, tx.index, v)