Skip to content

Commit

Permalink
https://github.com/neo-project/neo/pull/1847
Browse files Browse the repository at this point in the history
  • Loading branch information
ixje committed Jan 13, 2021
1 parent 5b2090c commit 041103c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion neo3/contracts/native/nativecontract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,8 +1191,16 @@ def on_balance_changing(self, engine: contracts.ApplicationEngine,

def on_persist(self, engine: contracts.ApplicationEngine) -> None:
super(NeoToken, self).on_persist(engine)
validators = self.get_validators(engine)

# distribute GAS for committee
gas_per_block = self.get_gas_per_block(engine.snapshot)
committee = self._get_committee_members(engine.snapshot)
pubkey = committee[engine.snapshot.persisting_block.index % len(settings.standby_committee)]
account = to_script_hash(contracts.Contract.create_signature_redeemscript(pubkey))
GasToken().mint(engine, account, gas_per_block * self._COMMITTEE_REWARD_RATIO / 100)

# set next validators
validators = committee[:settings.network.validators_count]
if self._validators_state is None:
self._validators_state = _ValidatorsState(engine.snapshot, validators)
self._validators_state.update(engine.snapshot, validators)
Expand Down

0 comments on commit 041103c

Please sign in to comment.