Skip to content

Commit

Permalink
SetGasPerBlock will take effect from the next block.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Aug 20, 2020
1 parent bd56d84 commit 138b62c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/neo/SmartContract/Native/Tokens/NeoToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,12 @@ private bool SetGasPerBlock(ApplicationEngine engine, BigInteger gasPerBlock)
if (gasPerBlock < 0 || gasPerBlock > 10 * GAS.Factor)
throw new ArgumentOutOfRangeException(nameof(gasPerBlock));
if (!CheckCommittee(engine)) return false;
uint index = engine.Snapshot.PersistingBlock.Index + 1;
GasRecord gasRecord = engine.Snapshot.Storages.GetAndChange(CreateStorageKey(Prefix_GasPerBlock)).GetInteroperable<GasRecord>();
if (gasRecord[^1].Index == engine.Snapshot.PersistingBlock.Index)
{
gasRecord[^1] = (engine.Snapshot.PersistingBlock.Index, gasPerBlock);
}
if (gasRecord[^1].Index == index)
gasRecord[^1] = (index, gasPerBlock);
else
{
gasRecord.Add((engine.Snapshot.PersistingBlock.Index, gasPerBlock));
}
gasRecord.Add((index, gasPerBlock));
return true;
}

Expand Down

0 comments on commit 138b62c

Please sign in to comment.