debugging trace-contract

This commit is contained in:
ThatBen 2025-06-20 12:13:34 +02:00
parent 0694655695
commit 48555223f8
No known key found for this signature in database
GPG Key ID: 62C543548433D43E

View File

@ -1,6 +1,7 @@
using BlockchainUtils;
using CodexContractsPlugin.Marketplace;
using Logging;
using Newtonsoft.Json;
using System.Numerics;
using Utils;
@ -118,7 +119,20 @@ namespace CodexContractsPlugin.ChainMonitor
private void ApplyEvent(Request request)
{
if (requests.Any(r => Equal(r.Request.RequestId, request.RequestId)))
throw new Exception("Received NewRequest event for id that already exists.");
{
var msg = "Received NewRequest event for id that already exists. ";
msg += "Received: " + JsonConvert.SerializeObject(request);
var r = FindRequest(request);
if (r != null)
{
msg += " Already have: " + JsonConvert.SerializeObject(r);
}
else
{
msg += " Already have: Not found!";
}
throw new Exception(msg);
}
var newRequest = new ChainStateRequest(log, request, RequestState.New);
requests.Add(newRequest);