Пример #1
0
        public void Run()
        {
            _logger.Information("Running spv wallet");
            var registry = new Registry();

            registry.Schedule(() =>
            {
                if (_lastHeight != CurrentHeight)
                {
                    _logger.Information($"Connected nodes -> {ConnectedNodes.Count()}");
                    _logger.Information($"Height -> {CurrentHeight}");
                    _lastHeight = CurrentHeight;

                    _logger.Information($"Wallet Balance -> {GetBalance()}");
                    SaveAsync();
                    _logger.Information("******************************************");
                }
            }).ToRunNow().AndEvery(10).Seconds();
            JobManager.Initialize(registry);
            JobManager.Start();

            //Console.CancelKeyPress += (sender, eArgs) => {
            //    _quitEvent.Set();
            //    eArgs.Cancel = true;
            //};

            _wallet.Tracker.NewOperation += Tracker_NewOperation;
            // kick off asynchronous stuff

            _quitEvent.WaitOne();
        }
Пример #2
0
 /// <summary>
 /// Calculates the degree of this node while only considering nodes that are in the subgraph. Ignores connections to all other nodes
 /// </summary>
 /// <param name="subGraph">The subgraph to calculate the remaining degree in</param>
 /// <returns>The remaining degree of this node in the subgraph</returns>
 public int RemainingDegree(HashSet <Node> subGraph) => ConnectedNodes.Count(n => subGraph.Contains(n));