Skip to content

Commit dacbad5

Browse files
authored
Merge pull request #203 from yungwine/mytonctrl2_dev
modes refactoring
2 parents e430afd + 28d264e commit dacbad5

File tree

10 files changed

+437
-561
lines changed

10 files changed

+437
-561
lines changed

mytoncore/functions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ def ValidatorDownEvent(local):
7979

8080

8181
def Elections(local, ton):
82-
usePool = local.db.get("usePool")
83-
if usePool == True:
82+
use_pool = ton.using_pool()
83+
use_liquid_staking = ton.using_liquid_staking()
84+
if use_pool:
8485
ton.PoolsUpdateValidatorSet()
85-
ton.RecoverStake()
86+
if use_liquid_staking:
87+
ton.ControllersUpdateValidatorSet()
88+
ton.RecoverStake()
89+
if ton.using_validator():
8690
ton.ElectionEntry()
87-
else:
88-
ton.RecoverStake()
89-
ton.ElectionEntry()
90-
# end define
9191

9292

9393
def Statistics(local):
@@ -516,10 +516,10 @@ def Complaints(local, ton):
516516

517517

518518
def Slashing(local, ton):
519-
isSlashing = local.db.get("isSlashing")
520-
if isSlashing is not True:
519+
is_slashing = local.db.get("isSlashing")
520+
is_validator = ton.using_validator()
521+
if is_slashing is not True or not is_validator:
521522
return
522-
# end if
523523

524524
# Creating complaints
525525
slash_time = local.buffer.slash_time

mytoncore/modes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
MODES = { # mode_name : is_enabled_by_default
2-
'Controller': False,
3-
'Validator': True
2+
'validator': True,
3+
'nominator-pool': False,
4+
'single-pool': False,
5+
'liquid-staking': False,
46
}

0 commit comments

Comments
 (0)