From 8ef1ddba6fad7bc7b9065d636bca7ee30df16ec2 Mon Sep 17 00:00:00 2001 From: Julien Muchembled Date: Fri, 9 Nov 2018 19:40:09 +0100 Subject: [PATCH] fixup! client: discard late answers to lockless writes Since commit 50e7fe5255eff41c19531ffeda50008577c2f798, some code can be simplified. --- neo/client/transactions.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/neo/client/transactions.py b/neo/client/transactions.py index f0f64244..2e589166 100644 --- a/neo/client/transactions.py +++ b/neo/client/transactions.py @@ -105,22 +105,15 @@ class Transaction(object): # conflict. Because we have no way to identify such case, we must keep # the data in self.data_dict until all nodes have answered so we remain # able to resolve conflicts. + data, serial, uuid_list = self.data_dict[oid] try: - data, serial, uuid_list = self.data_dict[oid] uuid_list.remove(uuid) - except KeyError: - # 1. store to S1 and S2 - # 2. S2 reports a conflict - # 3. store to S1 and S2 # conflict resolution - # 4. S1 does not report a conflict (lockless) - # 5. S2 answers before S1 for the second store - return except ValueError: # The most common case for this exception is because nodeLost() - # tries all oids blindly. Other possible cases: - # - like above (KeyError), but with S2 answering last - # - answer to resolved conflict before the first answer from a - # node that was being disconnected by the master + # tries all oids blindly. + # Another possible case is when we receive several positive answers + # from a node that is being disconnected by the master, whereas the + # first one (at least) should actually be conflict answer. return if lockless: if lockless != serial: # late lockless write -- 2.25.1