def deserialize(self, f):
    self.nVersion = struct.unpack('<i', f.read(4))[0]
    self.nServices = struct.unpack('<Q', f.read(8))[0]
    self.nTime = struct.unpack('<q', f.read(8))[0]
    self.addrTo = CAddress()
    self.addrTo.deserialize(f, with_time=False)
    self.addrFrom = CAddress()
    self.addrFrom.deserialize(f, with_time=False)
    self.nNonce = struct.unpack('<Q', f.read(8))[0]
    self.strSubVer = deser_string(f).decode('utf-8')
    self.nStartingHeight = struct.unpack('<i', f.read(4))[0]
    if (self.nVersion >= 70001):
        try:
            self.relay = struct.unpack('<b', f.read(1))[0]
        except:
            self.relay = 0
    else:
        self.relay = 0
def deserialize(self, f):
    self.nVersion = struct.unpack('<i', f.read(4))[0]
    self.nServices = struct.unpack('<Q', f.read(8))[0]
    self.nTime = struct.unpack('<q', f.read(8))[0]
    self.addrTo = CAddress()
    self.addrTo.deserialize(f, with_time=False)
    self.addrFrom = CAddress()
    self.addrFrom.deserialize(f, with_time=False)
    self.nNonce = struct.unpack('<Q', f.read(8))[0]
    self.strSubVer = deser_string(f).decode('utf-8')
    self.nStartingHeight = struct.unpack('<i', f.read(4))[0]
    if (self.nVersion >= 70001):
        try:
            self.relay = struct.unpack('<b', f.read(1))[0]
        except:
            self.relay = 0
    else:
        self.relay = 0