Skip to content

Commit 4855522

Browse files
committed
debugging trace-contract
1 parent 0694655 commit 4855522

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

ProjectPlugins/CodexContractsPlugin/ChainMonitor/ChainState.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using BlockchainUtils;
22
using CodexContractsPlugin.Marketplace;
33
using Logging;
4+
using Newtonsoft.Json;
45
using System.Numerics;
56
using Utils;
67

@@ -118,7 +119,20 @@ private void ApplyEvents(ulong blockNumber, IHasBlock[] blockEvents, DateTime ev
118119
private void ApplyEvent(Request request)
119120
{
120121
if (requests.Any(r => Equal(r.Request.RequestId, request.RequestId)))
121-
throw new Exception("Received NewRequest event for id that already exists.");
122+
{
123+
var msg = "Received NewRequest event for id that already exists. ";
124+
msg += "Received: " + JsonConvert.SerializeObject(request);
125+
var r = FindRequest(request);
126+
if (r != null)
127+
{
128+
msg += " Already have: " + JsonConvert.SerializeObject(r);
129+
}
130+
else
131+
{
132+
msg += " Already have: Not found!";
133+
}
134+
throw new Exception(msg);
135+
}
122136

123137
var newRequest = new ChainStateRequest(log, request, RequestState.New);
124138
requests.Add(newRequest);

0 commit comments

Comments
 (0)