diff --git a/pisa/appointment.py b/pisa/appointment.py index e81205a..61bd2e3 100644 --- a/pisa/appointment.py +++ b/pisa/appointment.py @@ -27,7 +27,8 @@ class Appointment: encrypted_blob_data = appointment_data.get("encrypted_blob") cipher = appointment_data.get("cipher") hash_function = appointment_data.get("hash_function") - triggered = appointment_data.get("triggered") + + triggered = True if appointment_data.get("triggered") is True else False if any( v is None diff --git a/pisa/inspector.py b/pisa/inspector.py index 68ac698..80ef214 100644 --- a/pisa/inspector.py +++ b/pisa/inspector.py @@ -16,34 +16,26 @@ logger = Logger("Inspector") class Inspector: def inspect(self, data): - locator = data.get("locator") - start_time = data.get("start_time") - end_time = data.get("end_time") - dispute_delta = data.get("dispute_delta") - encrypted_blob = data.get("encrypted_blob") - cipher = data.get("cipher") - hash_function = data.get("hash_function") - block_height = BlockProcessor.get_block_count() if block_height is not None: - rcode, message = self.check_locator(locator) + rcode, message = self.check_locator(data.get("locator")) if rcode == 0: - rcode, message = self.check_start_time(start_time, block_height) + rcode, message = self.check_start_time(data.get("start_time"), block_height) if rcode == 0: - rcode, message = self.check_end_time(end_time, start_time, block_height) + rcode, message = self.check_end_time(data.get("end_time"), data.get("start_time"), block_height) if rcode == 0: - rcode, message = self.check_delta(dispute_delta) + rcode, message = self.check_delta(data.get("dispute_delta")) if rcode == 0: - rcode, message = self.check_blob(encrypted_blob) + rcode, message = self.check_blob(data.get("encrypted_blob")) if rcode == 0: - rcode, message = self.check_cipher(cipher) + rcode, message = self.check_cipher(data.get("cipher")) if rcode == 0: - rcode, message = self.check_hash_function(hash_function) + rcode, message = self.check_hash_function(data.get("hash_function")) if rcode == 0: - r = Appointment(locator, start_time, end_time, dispute_delta, encrypted_blob, cipher, hash_function) + r = Appointment.from_dict(data) else: r = (rcode, message)