From 85f60ea04e768f6962c09a7ed68285537054d777 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 19 Dec 2022 01:04:49 +0100 Subject: [PATCH] Added check for already transferring resource to Link class --- RNS/Link.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/RNS/Link.py b/RNS/Link.py index 548b7b3..920813b 100644 --- a/RNS/Link.py +++ b/RNS/Link.py @@ -900,6 +900,13 @@ class Link: def register_incoming_resource(self, resource): self.incoming_resources.append(resource) + def has_incoming_resource(self, resource): + for incoming_resource in self.incoming_resources: + if incoming_resource.hash == resource.hash: + return True + + return False + def cancel_outgoing_resource(self, resource): if resource in self.outgoing_resources: self.outgoing_resources.remove(resource)