def deserialize(self, reader: serialization.BinaryReader) -> None: """ Deserialize the object from a binary stream. Args: reader: instance. """ self.account = reader.read_serializable(types.UInt160) self.scope = payloads.WitnessScope(reader.read_uint8()) if payloads.WitnessScope.CUSTOM_CONTRACTS in self.scope: self.allowed_contracts = reader.read_serializable_list( types.UInt160) if payloads.WitnessScope.CUSTOM_GROUPS in self.scope: self.allowed_groups = reader.read_serializable_list( cryptography.EllipticCurve.ECPoint)
def deserialize(self, reader: serialization.BinaryReader) -> None: """ Deserialize the object from a binary stream. Args: reader: instance. """ self.headers = reader.read_serializable_list(Header)
def deserialize(self, reader: serialization.BinaryReader) -> None: """ Deserialize the object from a binary stream. Args: reader: instance. """ self.deserialize_unsigned(reader) self.witnesses = reader.read_serializable_list(payloads.Witness)
def deserialize(self, reader: serialization.BinaryReader) -> None: """ Deserialize the object from a binary stream. Args: reader: instance. """ self.type = InventoryType(reader.read_uint8()) self.hashes = reader.read_serializable_list(types.UInt256)
def deserialize(self, reader: serialization.BinaryReader) -> None: """ Deserialize the object from a binary stream. Args: reader: instance. """ super(MerkleBlockPayload, self).deserialize(reader) self.content_count = reader.read_var_int() self.hashes = reader.read_serializable_list(types.UInt256) self.flags = reader.read_var_bytes()
def deserialize_unsigned(self, reader: serialization.BinaryReader) -> None: self.version = reader.read_uint8() if self.version > 0: raise ValueError("Deserialization error - invalid version") self.nonce = reader.read_uint32() self.sender = reader.read_serializable(types.UInt160) self.system_fee = reader.read_int64() if self.system_fee < 0: raise ValueError("Deserialization error - negative system fee") self.network_fee = reader.read_int64() if self.network_fee < 0: raise ValueError("Deserialization error - negative network fee") # Impossible overflow, only applicable to the C# implementation where they use longs # if (self.system_fee + self.network_fee < self.system_fee): # raise ValueError("Deserialization error - overflow") self.valid_until_block = reader.read_uint32() self.attributes = reader.read_serializable_list(TransactionAttribute) self.cosigners = reader.read_serializable_list(payloads.Cosigner) self.script = reader.read_var_bytes(max=65535) if len(self.script) == 0: raise ValueError("Deserialization error - invalid script length 0")
def deserialize(self, reader: serialization.BinaryReader) -> None: super(TrimmedBlock, self).deserialize(reader) self.hashes = reader.read_serializable_list(types.UInt256) if len(self.hashes) > 0: self.consensus_data = reader.read_serializable( payloads.ConsensusData)