示例#1
0
 public LyraNodeController(INodeAPI node,
                           INodeTransactionAPI trans
                           )
 {
     _node  = node;
     _trans = trans;
     _dex   = NodeService.Dealer;
 }
        public KeylessWallet(string accountId, Func <string, Task <string> > signer, INodeAPI client, INodeTransactionAPI trans)
        {
            _accountId = accountId;
            _signer    = signer;

            _node  = client;
            _trans = trans;
        }
示例#3
0
 public NodeController(
     ILogger <NodeController> logger,
     INodeAPI node,
     INodeTransactionAPI trans
     )
 {
     _log       = logger;
     _node      = node;
     _trans     = trans;
     _dtStarted = DateTime.Now;
 }
        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);
        }
 public SocketController(INodeAPI node, INodeTransactionAPI trans)
 {
     _node  = node;
     _trans = trans;
 }
示例#6
0
 public JsonRpcServer(INodeAPI node, INodeTransactionAPI trans) : base(node, trans)
 {
 }