def eth_getFilterLogs(filter_id): global filters global evm print("eth_getFilterLogs") filter_id = int(strip_0x(filter_id), 16) return encode_loglist(filters[filter_id].logs)
def getChanges(self): """Check for logs, return new ones. This method walks through the blocks given by :attr:`first_block` and :attr:`last_block`, looks at the contained logs, and collects the ones that match the filter. :returns: dictionary of new the logs since the last time `getChanges` was called. """ changes = {} to_block = self.filter.get('to_block', evm.block.number) if to_block in ['latest', 'pending']: to_block = self.evm.block.number for block_number, events in event_log.items(): if block_number < self.last_check: continue if block_number > to_block: break for event in events: if self.topics is not None: topic_match = True if len(event['log'].topics) < len(self.topics): topic_match = False for filter_topic, log_topic in zip(self.topics, event['log'].topics): if filter_topic is not None and filter_topic != log_topic: topic_match = False if not topic_match: continue # check for address if self.addresses is not None and event['log'].address not in self.addresses: continue #id_ = sha3rlp(event['log']) changes[event['log_idx']] = event self.last_check = self.evm.block.number self.log_dict.update(changes) return encode_loglist(changes.values())