Skip to content

Commit

Permalink
Throw exception in GetGasPerBlock()
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Aug 20, 2020
1 parent 138b62c commit 66e7eb5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/neo/SmartContract/Native/Tokens/NeoToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ private bool SetGasPerBlock(ApplicationEngine engine, BigInteger gasPerBlock)
public BigInteger GetGasPerBlock(StoreView snapshot)
{
var index = snapshot.PersistingBlock.Index;
GasRecord gasRecord = snapshot.Storages.TryGet(CreateStorageKey(Prefix_GasPerBlock)).GetInteroperable<GasRecord>();
GasRecord gasRecord = snapshot.Storages[CreateStorageKey(Prefix_GasPerBlock)].GetInteroperable<GasRecord>();
for (var i = gasRecord.Count - 1; i >= 0; i--)
{
if (gasRecord[i].Index <= index)
return gasRecord[i].GasPerBlock;
}
return 5 * GAS.Factor;
throw new InvalidOperationException();
}

[ContractMethod(0_03000000, CallFlags.AllowStates)]
Expand Down

0 comments on commit 66e7eb5

Please sign in to comment.