Raise exception when SINGLE destination is created without identity

This commit is contained in:
Mark Qvist 2024-09-16 18:20:53 +02:00
parent a91e67129e
commit d9e6145034

View File

@ -167,6 +167,9 @@ class Destination:
identity = RNS.Identity()
aspects = aspects+(identity.hexhash,)
if identity == None and direction == Destination.OUT and self.type != Destination.PLAIN:
raise ValueError("Can't create outbound SINGLE destination without an identity")
if identity != None and self.type == Destination.PLAIN:
raise TypeError("Selected destination type PLAIN cannot hold an identity")