Esempio n. 1
0
 def notify_peer_message(self, message, sender_id):
     """A new message was received from a peer"""
     self._notify(
         validator_pb2.Message.CONSENSUS_NOTIFY_PEER_MESSAGE,
         consensus_pb2.ConsensusNotifyPeerMessage(
             message=message,
             sender_id=sender_id))
Esempio n. 2
0
    def notify_peer_message(self, message, sender_id, message_type):
        """
        A new message was received from a peer
        before send check peer key using topology
        """
        LOGGER.debug('ConsensusNotifier: notify_peer_message=%s sender_id=%s',
                     message_type,
                     sender_id.hex()[:8])
        if message_type == 'Arbitration':
            """
            before send Arbitration we should be shure that this validator(sender_id) know about this block
            so we can send this block right now and send arbitration too or we can ask this block into Arbiter after recieving this msg
            """
            LOGGER.debug(
                'ConsensusNotifier: CHECK BLOCK for arbitration before send message consensus engine'
            )
        elif message_type == 'ArbitrationDone':
            LOGGER.debug(
                'ConsensusNotifier:  ArbitrationDone send block to arbiters')

        self._notify(
            validator_pb2.Message.CONSENSUS_NOTIFY_PEER_MESSAGE,
            consensus_pb2.ConsensusNotifyPeerMessage(message=message,
                                                     sender_id=sender_id))