From 66e7eb55b8fd5f92a13ef7f8ace607a8166c041c Mon Sep 17 00:00:00 2001 From: erikzhang Date: Thu, 20 Aug 2020 15:44:23 +0800 Subject: [PATCH] Throw exception in GetGasPerBlock() --- src/neo/SmartContract/Native/Tokens/NeoToken.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/neo/SmartContract/Native/Tokens/NeoToken.cs b/src/neo/SmartContract/Native/Tokens/NeoToken.cs index da1fe50433..452044300b 100644 --- a/src/neo/SmartContract/Native/Tokens/NeoToken.cs +++ b/src/neo/SmartContract/Native/Tokens/NeoToken.cs @@ -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 = snapshot.Storages[CreateStorageKey(Prefix_GasPerBlock)].GetInteroperable(); 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)]