From 302c498cc6b8ea85d22ffe8cd507ed5572661350 Mon Sep 17 00:00:00 2001 From: yungwine Date: Fri, 17 May 2024 18:02:57 +0700 Subject: [PATCH] sort complaints Sort complaints by their creation time so all validators can vote for same complaints as they are in determenistic order --- mytoncore/mytoncore.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mytoncore/mytoncore.py b/mytoncore/mytoncore.py index f230c381..ffa5d3ab 100644 --- a/mytoncore/mytoncore.py +++ b/mytoncore/mytoncore.py @@ -2280,6 +2280,9 @@ def GetComplaints(self, electionId=None, past=False): complaints[chash] = item #end for + # sort complaints by their creation time and hash + complaints = dict(sorted(complaints.items(), key=lambda item: (item[1]["createdTime"], item[0]))) + # Set buffer self.SetFunctionBuffer(bname, complaints)