Skip to content

Commit 4569a2e

Browse files
committed
fix parsing negative offers
1 parent 0772837 commit 4569a2e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

mytoncore/mytoncore.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3216,12 +3216,15 @@ def set_initial_sync_off(self):
32163216
self.local.db.pop('initialSync', None)
32173217
self.local.save()
32183218

3219-
def Tlb2Json(self, text):
3219+
def Tlb2Json(self, text: str):
32203220
# Заменить скобки
32213221
start = 0
32223222
end = len(text)
32233223
if '=' in text:
32243224
start = text.find('=')+1
3225+
if text[start:].startswith(' x{'): # param has no tlb scheme, return cell value
3226+
end = text.rfind('}')+1
3227+
return {'_': text[start:end].strip()}
32253228
if "x{" in text:
32263229
end = text.find("x{")
32273230
text = text[start:end]

mytonctrl/mytonctrl.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ def PrintStatus(local, ton, args):
631631
startWorkTime = ton.GetActiveElectionId(fullElectorAddr)
632632
validator_index = ton.GetValidatorIndex()
633633

634-
offersNumber = ton.GetOffersNumber()
635-
complaintsNumber = ton.GetComplaintsNumber()
634+
offersNumber = local.try_function(ton.GetOffersNumber)
635+
complaintsNumber = local.try_function(ton.GetComplaintsNumber)
636636

637637
tpsAvg = ton.GetStatistics("tpsAvg", statistics)
638638

@@ -654,10 +654,10 @@ def PrintTonStatus(local, network_name, startWorkTime, totalValidators, onlineVa
654654
#tps5 = tpsAvg[1]
655655
#tps15 = tpsAvg[2]
656656
allValidators = totalValidators
657-
newOffers = offersNumber.get("new")
658-
allOffers = offersNumber.get("all")
659-
newComplaints = complaintsNumber.get("new")
660-
allComplaints = complaintsNumber.get("all")
657+
newOffers = offersNumber.get("new") if offersNumber else 'n/a'
658+
allOffers = offersNumber.get("all") if offersNumber else 'n/a'
659+
newComplaints = complaintsNumber.get("new") if complaintsNumber else 'n/a'
660+
allComplaints = complaintsNumber.get("all") if complaintsNumber else 'n/a'
661661
#tps1_text = bcolors.green_text(tps1)
662662
#tps5_text = bcolors.green_text(tps5)
663663
#tps15_text = bcolors.green_text(tps15)

0 commit comments

Comments
 (0)