public JsonRpcServerBase(INodeAPI node, INodeTransactionAPI trans) { _node = node; _trans = trans; if (_queue == null && NodeService.Dag != null) { _queue = new ConcurrentQueue <TxInfoBase>(); _haveBlock = new EventWaitHandle(false, EventResetMode.ManualReset); _instances = new ConcurrentDictionary <int, JsonRpcServerBase>(); NodeService.Dag.OnNewBlock += NewBlockMonitor; _ = Task.Run(async() => { while (true) { await _haveBlock.AsTaskAsync(); _haveBlock.Reset(); TxInfoBase info; while (_queue.TryDequeue(out info)) { foreach (var inst in _instances.Values) { try { if (inst.GetIfInterested(info.to)) { inst.Notify?.Invoke(this, new News { catalog = info.GetType().Name, content = info }); } } catch { } } } } }).ConfigureAwait(false); } _instances?.TryAdd(this.GetHashCode(), this); }