示例#1
0
 def send_handshake(self, genesis_hash: Hash32, head_slot: Slot) -> None:
     resp = StatusMessage(
         protocol_version=self.version,
         network_id=self.peer.network_id,
         genesis_hash=genesis_hash,
         head_slot=head_slot,
     )
     cmd = Status(self.cmd_id_offset, self.snappy_support)
     self.logger.debug2("Sending BCC/Status msg: %s", resp)
     self.send(*cmd.encode(resp))
示例#2
0
文件: proto.py 项目: renaynay/trinity
 def send_handshake(self, handshake_params: BCCHandshakeParams) -> None:
     if self.version != handshake_params.protocol_version:
         raise ValidationError(
             f"BCC protocol version mismatch: "
             f"params:{handshake_params.protocol_version} != proto:{self.version}"
         )
     resp = StatusMessage(
         protocol_version=handshake_params.protocol_version,
         network_id=handshake_params.network_id,
         genesis_root=handshake_params.genesis_root,
         head_slot=handshake_params.head_slot,
     )
     cmd = Status(self.cmd_id_offset, self.snappy_support)
     self.logger.debug2("Sending BCC/Status msg: %s", resp)
     self.transport.send(*cmd.encode(resp))