def _send_changes(self, block, deltas, subscriber): state_change_evt = StateDeltaEvent( block_id=block.header_signature, block_num=block.header.block_num, state_root_hash=block.header.state_root_hash, state_changes=subscriber.deltas_of_interest(deltas)) LOGGER.debug('sending change event to %s', subscriber.connection_id) self._send(subscriber.connection_id, state_change_evt.SerializeToString())
def _broadcast_changes(self, block, deltas): state_change_evt = StateDeltaEvent( block_id=block.header_signature, block_num=block.header.block_num, state_root_hash=block.header.state_root_hash) for subscriber in self._subscribers.values(): acceptable_changes = subscriber.deltas_of_interest(deltas) state_change_evt.ClearField('state_changes') if len(acceptable_changes) > 0: state_change_evt.state_changes.extend(acceptable_changes) LOGGER.debug('sending change event to %s', subscriber.connection_id) self._send(subscriber.connection_id, state_change_evt.SerializeToString())