Rehabilitate gas filter

This commit is contained in:
nolash 2021-02-22 22:22:25 +01:00
parent 1f126037fe
commit 5a6fe7327d
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
5 changed files with 29 additions and 8 deletions

View File

@ -105,3 +105,6 @@ class CallbackFilter(SyncFilter):
self.call_back(tokentx.to_dict()) self.call_back(tokentx.to_dict())
except UnknownContractError: except UnknownContractError:
logg.debug('callback filter {}:{} skipping "transfer" method on unknown contract {} tx {}'.format(tc.queue, tc.method, transfer_data['to'], tx.hash.hex())) logg.debug('callback filter {}:{} skipping "transfer" method on unknown contract {} tx {}'.format(tc.queue, tc.method, transfer_data['to'], tx.hash.hex()))
def __str__(self):
return 'cic-eth callbacks'

View File

@ -22,10 +22,9 @@ class GasFilter(SyncFilter):
self.queue = queue self.queue = queue
def filter(self, w3, tx, rcpt, chain_str, session=None): def filter(self, conn, block, tx, session): #rcpt, chain_str, session=None):
logg.debug('applying gas filter') tx_hash_hex = tx.hash
tx_hash_hex = tx.hash.hex() if tx.value > 0:
if tx['value'] > 0:
logg.debug('gas refill tx {}'.format(tx_hash_hex)) logg.debug('gas refill tx {}'.format(tx_hash_hex))
session = SessionBase.bind_session(session) session = SessionBase.bind_session(session)
q = session.query(TxCache.recipient) q = session.query(TxCache.recipient)
@ -54,3 +53,7 @@ class GasFilter(SyncFilter):
queue=self.queue, queue=self.queue,
) )
s.apply_async() s.apply_async()
def __str__(self):
return 'eic-eth gasfilter'

View File

@ -37,3 +37,8 @@ class RegistrationFilter(SyncFilter):
queue=self.queue, queue=self.queue,
) )
s.apply_async() s.apply_async()
def __str__(self):
return 'cic-eth account registration'

View File

@ -39,3 +39,7 @@ class TxFilter(SyncFilter):
) )
t = s.apply_async() t = s.apply_async()
return t return t
def __str__(self):
return 'cic-eth erc20 transfer filter'

View File

@ -98,11 +98,17 @@ def main():
syncers = [] syncers = []
if SyncerBackend.first(chain_spec): #if SyncerBackend.first(chain_spec):
backend = SyncerBackend.initial(chain_spec, block_offset) # backend = SyncerBackend.initial(chain_spec, block_offset)
syncer_backends = SyncerBackend.resume(chain_spec, block_offset)
if len(syncer_backends) == 0:
syncer_backends.append(SyncerBackend.initial(chain_spec, block_offset))
#block_sync = SyncerBackend.live(chain_spec, block_offset+1)
for syncer_backend in syncer_backends:
syncers.append(HeadSyncer(syncer_backend))
block_sync = SyncerBackend.live(chain_spec, block_offset+1)
syncers.append(HeadSyncer(block_sync))
trusted_addresses_src = config.get('CIC_TRUST_ADDRESS') trusted_addresses_src = config.get('CIC_TRUST_ADDRESS')
if trusted_addresses_src == None: if trusted_addresses_src == None: