Skip to content

Commit

Permalink
Dispose ApplicationEngine after using (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
cn1010 authored and erikzhang committed Dec 10, 2019
1 parent f011208 commit ccc5d04
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions RpcNep5Tracker/RpcNep5Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ public void OnPersist(Snapshot snapshot, IReadOnlyList<Blockchain.ApplicationExe
script = sb.ToArray();
}

ApplicationEngine engine = ApplicationEngine.Run(script, snapshot, extraGAS: new Fixed8(100000000));
if (engine.State.HasFlag(VMState.FAULT)) continue;
if (engine.ResultStack.Count <= 0) continue;
nep5BalancePair.Value.Balance = engine.ResultStack.Pop().GetBigInteger();
using (ApplicationEngine engine = ApplicationEngine.Run(script, snapshot, extraGAS: new Fixed8(100000000)))
{
if (engine.State.HasFlag(VMState.FAULT)) continue;
if (engine.ResultStack.Count <= 0) continue;
nep5BalancePair.Value.Balance = engine.ResultStack.Pop().GetBigInteger();
}
nep5BalancePair.Value.LastUpdatedBlock = snapshot.Height;
if (nep5BalancePair.Value.Balance == 0)
{
Expand Down

0 comments on commit ccc5d04

Please sign in to comment.