diff --git a/src/neo/SmartContract/ApplicationEngine.cs b/src/neo/SmartContract/ApplicationEngine.cs index 8b8daa6c62..6b00615624 100644 --- a/src/neo/SmartContract/ApplicationEngine.cs +++ b/src/neo/SmartContract/ApplicationEngine.cs @@ -58,7 +58,7 @@ protected ApplicationEngine(TriggerType trigger, IVerifiable container, StoreVie this.testMode = testMode; } - internal void AddGas(long gas) + protected internal void AddGas(long gas) { GasConsumed = checked(GasConsumed + gas); if (!testMode && GasConsumed > gas_amount) @@ -217,12 +217,17 @@ public override void Dispose() base.Dispose(); } - protected override void OnSysCall(uint method) + protected void ValidateCallFlags(InteropDescriptor descriptor) { - InteropDescriptor descriptor = services[method]; ExecutionContextState state = CurrentContext.GetState(); if (!state.CallFlags.HasFlag(descriptor.RequiredCallFlags)) throw new InvalidOperationException($"Cannot call this SYSCALL with the flag {state.CallFlags}."); + } + + protected override void OnSysCall(uint method) + { + InteropDescriptor descriptor = services[method]; + ValidateCallFlags(descriptor); AddGas(descriptor.FixedPrice); List parameters = descriptor.Parameters.Count > 0 ? new List()