Skip to content

Commit

Permalink
https://github.com/neo-project/neo/pull/1907
Browse files Browse the repository at this point in the history
  • Loading branch information
ixje committed Jan 18, 2021
1 parent a440e54 commit 03cc285
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions neo3/contracts/native/nativecontract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,9 @@ def _calculate_bonus(self, snapshot: storage.Snapshot, value: vm.BigInteger, sta
break
return value * gas_sum * self._NEO_HOLDER_REWARD_RATIO / 100 / self.total_amount

def _should_refresh_committee(self, height: int) -> bool:
return height % (len(settings.standby_committee) + settings.network.validators_count) == 0

def init(self):
super(NeoToken, self).init()
# singleton init, similar to __init__ but called only once
Expand Down Expand Up @@ -1198,8 +1201,9 @@ def on_persist(self, engine: contracts.ApplicationEngine) -> None:
super(NeoToken, self).on_persist(engine)

# set next validators
validators = self.get_validators(engine)
self._validators_state.update(engine.snapshot, validators)
if self._should_refresh_committee(engine.snapshot.block_height):
validators = self.get_validators(engine)
self._validators_state.update(engine.snapshot, validators)

def post_persist(self, engine: contracts.ApplicationEngine):
super(NeoToken, self).post_persist(engine)
Expand Down

0 comments on commit 03cc285

Please sign in to comment.