public StratumServiceTests()
        {
            _shareManager = Substitute.For<IShareManager>();
            _poolConfig = Substitute.For<IPoolConfig>();

            var miner = Substitute.For<IStratumMiner>();
            _stratumContext = Substitute.For<StratumContext>(miner);
        }
Example #2
0
        private void ProcessRequest(string line)
        {
            try
            {
                var rpcContext = new StratumContext(this); // set the context.
                _packetLogger.Verbose("rx: {0}", line.PrettifyJson());

                var async1 = new JsonRpcStateAsync(_rpcResultHandler, rpcContext)
                {
                    JsonRpc = line
                };
                JsonRpcProcessor.Process(Pool.Config.Coin.Name, async1, rpcContext);
            }
            catch (JsonReaderException e) // if client sent an invalid message
            {
                _logger.Error("Disconnecting miner {0:l} as we recieved an invalid json-rpc request - {1:l}",
                              Username ?? Connection.RemoteEndPoint.ToString(), e.Message);

                Connection.Disconnect(); // disconnect him.
            }
        }
Example #3
0
        private void ProcessRequest(string line)
        {
            try
            {
                var rpcContext = new StratumContext(this); // set the context.

                _packetLogger.Verbose("rx: {0}", line.PrettifyJson());

                var async = new JsonRpcStateAsync(_rpcResultHandler, rpcContext) {JsonRpc = line};
                JsonRpcProcessor.Process(Pool.Config.Coin.Name, async, rpcContext);
            }
            catch (JsonReaderException e) // if client sent an invalid message
            {
                _logger.Error("Disconnecting miner {0:l} as we recieved an invalid json-rpc request - {1:l}",
                    Username ?? Connection.RemoteEndPoint.ToString(), e.Message);

                Connection.Disconnect(); // disconnect him.
            }
        }