Fix bug where announce_identity could be undefined

This commit is contained in:
Dionysis Grigoropoulos 2023-01-26 22:05:38 +02:00
parent 0f023cc533
commit 72ca6316f6

View File

@ -1427,12 +1427,12 @@ class Transport:
# Check that the announced destination matches # Check that the announced destination matches
# the handlers aspect filter # the handlers aspect filter
execute_callback = False execute_callback = False
announce_identity = RNS.Identity.recall(packet.destination_hash)
if handler.aspect_filter == None: if handler.aspect_filter == None:
# If the handlers aspect filter is set to # If the handlers aspect filter is set to
# None, we execute the callback in all cases # None, we execute the callback in all cases
execute_callback = True execute_callback = True
else: else:
announce_identity = RNS.Identity.recall(packet.destination_hash)
handler_expected_hash = RNS.Destination.hash_from_name_and_identity(handler.aspect_filter, announce_identity) handler_expected_hash = RNS.Destination.hash_from_name_and_identity(handler.aspect_filter, announce_identity)
if packet.destination_hash == handler_expected_hash: if packet.destination_hash == handler_expected_hash:
execute_callback = True execute_callback = True