Compare commits

..

1 Commits

Author SHA1 Message Date
lash
618471fcc5
Upgrade deps 2022-03-05 07:37:28 +00:00
2 changed files with 14 additions and 12 deletions

View File

@ -74,21 +74,23 @@ class GasAddFilter:
self.recipients = recipients self.recipients = recipients
self.tx_gas = {} self.tx_gas = {}
self.gas_sum = 0 self.gas_sum = 0
self.match_label = None
if len(senders) == 0 and len(recipients) == 0:
self.match_label = 'match'
def filter(self, conn, block, tx, db_session): def filter(self, conn, block, tx, db_session):
sender = hex_uniform(strip_0x(tx.outputs[0])) sender = hex_uniform(strip_0x(tx.outputs[0]))
recipient = hex_uniform(strip_0x(tx.inputs[0])) recipient = hex_uniform(strip_0x(tx.inputs[0]))
match_label = self.match_label
if match_label == None:
if sender in self.senders: if sender in self.senders:
self.gas_sum += tx.gas_used match_label = 'sender ' + sender
self.tx_gas[tx.hash] = tx.gas_used
logg.info('sender {} tx {} ({}/{}) gas {} new sum {}'.format(sender, tx.hash, tx.block.number, tx.index, tx.gas_used, self.gas_sum))
elif recipient in self.recipients: elif recipient in self.recipients:
match_label = 'recipient ' + receipient
self.gas_sum += tx.gas_used self.gas_sum += tx.gas_used
self.tx_gas[tx.hash] = tx.gas_used self.tx_gas[tx.hash] = tx.gas_used
logg.info('recipient {} tx {} ({}/{}) gas {} new sum {}'.format(recipient, tx.hash, tx.block.number, tx.index, tx.gas_used, self.gas_sum)) logg.info('{} tx {} ({}/{}) gas {} new sum {}'.format(match_label, tx.hash, tx.block.number, tx.index, tx.gas_used, self.gas_sum))
def sum(self): def sum(self):
return self.gas_sum return self.gas_sum

View File

@ -1,2 +1,2 @@
chainsyncer==0.0.7a3 chainsyncer~=0.1.0
chainlib-eth==0.0.10a16 chainlib-eth>=0.1.0b1,<=0.1.0