Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon authored Nov 13, 2020
1 parent ff729ec commit 2b303d1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/ApplicationLogs/LogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public JObject GetApplicationLog(JArray _params)
if (value is null)
throw new RpcException(-100, "Unknown transaction/blockhash");

var raw = JObject.Parse(Utility.StrictUTF8.GetString(value));
//Additional optional "trigger" parameter to getapplicationlog for clients to be able to get just one execution result for a block.
if (_params.Count >= 2 && Enum.TryParse(_params[1].AsString(), true, out TriggerType trigger))
{
var raw = JObject.Parse(Utility.StrictUTF8.GetString(value));
var executions = raw["executions"] as JArray;
for (int i = 0; i < executions.Count;)
{
Expand All @@ -52,12 +52,8 @@ public JObject GetApplicationLog(JArray _params)
else
i++;
}
return raw;
}
else
{
return JObject.Parse(Utility.StrictUTF8.GetString(value));
}
return raw;
}

public void OnPersist(StoreView snapshot, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList)
Expand Down

0 comments on commit 2b303d1

Please sign in to comment.