Esempio n. 1
0
    def deserialize(self, reader: BinaryReader) -> None:
        """
        Deserialize the object from a binary stream.

        Args:
            reader: instance.
        """
        self._deserialize_from_json(json.loads(reader.read_var_string(self.MAX_LENGTH)))
Esempio n. 2
0
    def deserialize(self, reader: serialization.BinaryReader) -> None:
        """
        Deserialize the object from a binary stream.

        Args:
            reader: instance.
        """
        self.magic = reader.read_uint32()
        self.version = reader.read_uint32()
        self.timestamp = reader.read_uint32()
        self.nonce = reader.read_uint32()
        self.user_agent = reader.read_var_string(max=1024)

        capabilities_cnt = reader.read_var_int(self.MAX_CAPABILITIES)
        capabilities_list = []
        for _ in range(capabilities_cnt):
            capabilities_list.append(capabilities.NodeCapability.deserialize_from(reader))
        self.capabilities = capabilities_list