Skip to content

Commit

Permalink
Fix-RpcNep5Tracker, prevent it from leveldb bug. (2x) (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
superboyiii authored and erikzhang committed Jan 8, 2020
1 parent ccc5d04 commit 30ddf5c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion RpcNep5Tracker/RpcNep5Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class RpcNep5Tracker : Plugin, IPersistencePlugin, IRpcPlugin
private uint _maxResults;
private bool _shouldTrackNonStandardMintTokensEvent;
private Neo.IO.Data.LevelDB.Snapshot _levelDbSnapshot;
private static readonly Fixed8 maxGas = Fixed8.FromDecimal(1m);

public override void Configure()
{
Expand Down Expand Up @@ -191,12 +192,13 @@ public void OnPersist(Snapshot snapshot, IReadOnlyList<Blockchain.ApplicationExe
script = sb.ToArray();
}

using (ApplicationEngine engine = ApplicationEngine.Run(script, snapshot, extraGAS: new Fixed8(100000000)))
using (ApplicationEngine engine = ApplicationEngine.Run(script, snapshot, extraGAS: maxGas))
{
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 30ddf5c

Please sign in to comment.