Skip to content

Commit

Permalink
Add MaxVerificationGas (neo-project#1745)
Browse files Browse the repository at this point in the history
Co-authored-by: Shargon <shargon@gmail.com>
  • Loading branch information
2 people authored and ShawnYun committed Jul 6, 2020
1 parent 67ca3f8 commit 58e62a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/neo/SmartContract/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Neo.SmartContract
{
public static class Helper
{
private const long MaxVerificationGas = 0_50000000;

public static UInt160 GetScriptHash(this ExecutionContext context)
{
return context.GetState<ExecutionContextState>().ScriptHash;
Expand Down Expand Up @@ -130,6 +132,7 @@ public static UInt160 ToScriptHash(this ReadOnlySpan<byte> script)
internal static bool VerifyWitnesses(this IVerifiable verifiable, StoreView snapshot, long gas)
{
if (gas < 0) return false;
if (gas > MaxVerificationGas) gas = MaxVerificationGas;

UInt160[] hashes;
try
Expand Down

0 comments on commit 58e62a1

Please sign in to comment.