From 48943dc1837fcd859855b6250843972534016b6d Mon Sep 17 00:00:00 2001 From: sonofmom Date: Thu, 2 Jul 2020 16:57:03 +0200 Subject: [PATCH 1/2] Fix parsing of validatorWeight --- mytoncore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mytoncore.py b/mytoncore.py index 43fd7bd2..d9cc5cf9 100644 --- a/mytoncore.py +++ b/mytoncore.py @@ -557,7 +557,7 @@ def GetConfig34(self): if "public_key:" in line: validatorAdnlAddr = Pars(line, "adnl_addr:x", ')') validatorPubkey = Pars(line, "pubkey:x", ')') - validatorWeight = int(Pars(line, "weight:", ' ')) + validatorWeight = int(Pars(line, "weight:", ')')) buff = dict() buff["adnlAddr"] = validatorAdnlAddr buff["pubkey"] = validatorPubkey From 9ee904a100f354fe3244df9d4a3b8bf09ec838ba Mon Sep 17 00:00:00 2001 From: sonofmom Date: Fri, 3 Jul 2020 12:30:33 +0200 Subject: [PATCH 2/2] Add if to detect uninitialized net --- mytoncore.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mytoncore.py b/mytoncore.py index d9cc5cf9..a3e774b2 100644 --- a/mytoncore.py +++ b/mytoncore.py @@ -557,7 +557,10 @@ def GetConfig34(self): if "public_key:" in line: validatorAdnlAddr = Pars(line, "adnl_addr:x", ')') validatorPubkey = Pars(line, "pubkey:x", ')') - validatorWeight = int(Pars(line, "weight:", ')')) + if config34["totalValidators"] > 1: + validatorWeight = int(Pars(line, "weight:", ' ')) + else: + validatorWeight = int(Pars(line, "weight:", ')')) buff = dict() buff["adnlAddr"] = validatorAdnlAddr buff["pubkey"] = validatorPubkey