Compare commits

..

No commits in common. "master" and "674b5b9ae0d97ef81575fc362d31ae548bd23d37" have entirely different histories.

2 changed files with 12 additions and 14 deletions

View File

@ -74,23 +74,21 @@ 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:
match_label = 'sender ' + sender
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('{} tx {} ({}/{}) gas {} new sum {}'.format(match_label, tx.hash, tx.block.number, tx.index, tx.gas_used, self.gas_sum)) 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:
self.gas_sum += 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))
def sum(self): def sum(self):
return self.gas_sum return self.gas_sum

View File

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