File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
ProjectPlugins/CodexContractsPlugin/ChainMonitor Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 1
1
using BlockchainUtils;
2
2
using CodexContractsPlugin.Marketplace;
3
3
using Logging;
4
+ using Nethereum.Hex.HexConvertors.Extensions;
4
5
using Newtonsoft.Json;
5
6
using System.Numerics;
6
7
using Utils;
@@ -120,18 +121,14 @@ private void ApplyEvent(Request request)
120
121
{
121
122
if (requests.Any(r => Equal(r.Request.RequestId, request.RequestId)))
122
123
{
123
- var msg = "Received NewRequest event for id that already exists. ";
124
- msg += "Received: " + JsonConvert.SerializeObject(request);
125
124
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);
125
+ if (r == null) throw new Exception("ChainState is inconsistent. Received already-known requestId that's not known.");
126
+
127
+ if (request.Block.BlockNumber != r.Request.Block.BlockNumber) throw new Exception("Same request found in different blocks.");
128
+ if (request.Client != r.Request.Client) throw new Exception("Same request belongs to different clients.");
129
+ if (request.Content.Cid.ToHex() != r.Request.Content.Cid.ToHex()) throw new Exception("Same request has different CIDs.");
130
+
131
+ log.Log("Received the same request-creation event multiple times.");
135
132
}
136
133
137
134
var newRequest = new ChainStateRequest(log, request, RequestState.New);
You can’t perform that action at this time.
0 commit comments