Compare commits
1 Commits
674b5b9ae0
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
618471fcc5 |
@ -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]))
|
||||||
if sender in self.senders:
|
match_label = self.match_label
|
||||||
self.gas_sum += tx.gas_used
|
if match_label == None:
|
||||||
self.tx_gas[tx.hash] = tx.gas_used
|
if sender in self.senders:
|
||||||
logg.info('sender {} tx {} ({}/{}) gas {} new sum {}'.format(sender, tx.hash, tx.block.number, tx.index, tx.gas_used, self.gas_sum))
|
match_label = 'sender ' + sender
|
||||||
elif recipient in self.recipients:
|
elif recipient in self.recipients:
|
||||||
self.gas_sum += tx.gas_used
|
match_label = 'recipient ' + receipient
|
||||||
self.tx_gas[tx.hash] = tx.gas_used
|
self.gas_sum += 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))
|
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):
|
def sum(self):
|
||||||
return self.gas_sum
|
return self.gas_sum
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user