Compare commits
1 Commits
674b5b9ae0
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
618471fcc5 |
@ -74,21 +74,23 @@ class GasAddFilter:
|
||||
self.recipients = recipients
|
||||
self.tx_gas = {}
|
||||
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):
|
||||
sender = hex_uniform(strip_0x(tx.outputs[0]))
|
||||
recipient = hex_uniform(strip_0x(tx.inputs[0]))
|
||||
if sender in self.senders:
|
||||
self.gas_sum += tx.gas_used
|
||||
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:
|
||||
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))
|
||||
|
||||
|
||||
match_label = self.match_label
|
||||
if match_label == None:
|
||||
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.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))
|
||||
|
||||
def sum(self):
|
||||
return self.gas_sum
|
||||
|
@ -1,2 +1,2 @@
|
||||
chainsyncer==0.0.7a3
|
||||
chainlib-eth==0.0.10a16
|
||||
chainsyncer~=0.1.0
|
||||
chainlib-eth>=0.1.0b1,<=0.1.0
|
||||
|
Loading…
Reference in New Issue
Block a user