Skip to content

Commit 3d274b1

Browse files
authored
Merge pull request #174 from yungwine/mytonctrl2_dev
fix GetValidatorKey() and update duplicateApi
2 parents 6b257e5 + c28197d commit 3d274b1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mytoncore/mytoncore.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,8 @@ def SendFile(self, filePath, wallet=None, **kwargs):
12051205
timeout = kwargs.get("timeout", 30)
12061206
remove = kwargs.get("remove", True)
12071207
duplicateSendfile = self.local.db.get("duplicateSendfile", True)
1208-
duplicateApi = self.local.db.get("duplicateApi", False)
1208+
telemetry = self.local.db.get("sendTelemetry", False)
1209+
duplicateApi = self.local.db.get("duplicateApi", telemetry)
12091210
if not os.path.isfile(filePath):
12101211
raise Exception("SendFile error: no such file '{filePath}'".format(filePath=filePath))
12111212
if timeout and wallet:
@@ -1911,12 +1912,13 @@ def MoveCoinsFromHW(self, wallet, destList, **kwargs):
19111912

19121913
def GetValidatorKey(self):
19131914
vconfig = self.GetValidatorConfig()
1914-
for validator in vconfig["validators"]:
1915+
validators = sorted(vconfig["validators"], key=lambda i: i['election_date'], reverse=True)
1916+
for validator in validators:
19151917
validatorId = validator["id"]
19161918
key_bytes = base64.b64decode(validatorId)
19171919
validatorKey = key_bytes.hex().upper()
19181920
timestamp = get_timestamp()
1919-
if timestamp > validator["election_date"]:
1921+
if validator["election_date"] < timestamp < validator["expire_at"]:
19201922
return validatorKey
19211923
raise Exception("GetValidatorKey error: validator key not found. Are you sure you are a validator?")
19221924
#end define

0 commit comments

Comments
 (0)