From 041103c42d7866ac97191399808444e5b791692c Mon Sep 17 00:00:00 2001 From: Erik van den Brink Date: Wed, 13 Jan 2021 10:49:22 +0100 Subject: [PATCH] https://github.com/neo-project/neo/pull/1847 --- neo3/contracts/native/nativecontract.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/neo3/contracts/native/nativecontract.py b/neo3/contracts/native/nativecontract.py index e8190b67..38f908a4 100644 --- a/neo3/contracts/native/nativecontract.py +++ b/neo3/contracts/native/nativecontract.py @@ -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)