コード例 #1
0
 public PeerManagerProvider(
     INBXplorerClientProvider nbXplorerClientProvider,
     NRustLightningNetworkProvider networkProvider,
     IKeysRepository keysRepository,
     ILoggerFactory loggerFactory,
     ChannelProvider channelProvider,
     IOptions <Config> config
     )
 {
     foreach (var n in networkProvider.GetAll())
     {
         var nbx = nbXplorerClientProvider.TryGetClient(n);
         if (nbx != null)
         {
             var b      = new NbXplorerBroadcaster(nbx, loggerFactory.CreateLogger <NbXplorerBroadcaster>());
             var feeEst = new NbXplorerFeeEstimator(loggerFactory.CreateLogger <NbXplorerFeeEstimator>(),
                                                    channelProvider.GetFeeRateChannel(n).Reader);
             var chainWatchInterface =
                 new NbxChainWatchInterface(nbx, loggerFactory.CreateLogger <NbxChainWatchInterface>(), n);
             var peerManSeed = new byte[32];
             RandomUtils.GetBytes(peerManSeed);
             var logger          = new NativeLogger(loggerFactory.CreateLogger <NativeLogger>());
             var nbitcoinNetwork = n.NBitcoinNetwork;
             var conf            = config.Value.RustLightningConfig;
             var peerMan         = PeerManager.Create(peerManSeed.AsSpan(), nbitcoinNetwork, conf, chainWatchInterface, keysRepository, b,
                                                      logger, feeEst, 400000);
             _peerManagers.Add(n.CryptoCode, peerMan);
         }
     }
 }
コード例 #2
0
 public NBXplorerListeners(NRustLightningNetworkProvider networkProvider, INBXplorerClientProvider clientProvider, PeerManagerProvider peerManagerProvider, ILoggerFactory loggerFactory,
                           ChannelProvider channelProvider)
 {
     foreach (var n in networkProvider.GetAll())
     {
         var cli = clientProvider.TryGetClient(n);
         if (cli != null)
         {
             var listener = new NBXplorerListener(cli, peerManagerProvider, loggerFactory.CreateLogger <NBXplorerListener>(), channelProvider.GetFeeRateChannel(n).Writer, n);
             _listeners.TryAdd(n.CryptoCode, listener);
         }
     }
 }
コード例 #3
0
 public WorkQueueProcessor(ChannelProvider channelProvider, P2PConnectionHandler p2PConnectionHandler,
                           ILogger <WorkQueueProcessor> logger, PeerManagerProvider peerManagerProvider, NRustLightningNetwork network,
                           IWalletService walletService, IRepository repo)
 {
     _channelProvider      = channelProvider;
     _p2PConnectionHandler = p2PConnectionHandler;
     _logger = logger;
     _peerManagerProvider = peerManagerProvider;
     _network             = network;
     _walletService       = walletService;
     _repo  = repo;
     _tasks = new [] { HandleOutboundConnectQueue(), HandleSpendableOutputEventQueue() };
 }
コード例 #4
0
 public PeerManagerProvider(
     INBXplorerClientProvider nbXplorerClientProvider,
     NRustLightningNetworkProvider networkProvider,
     IKeysRepository keysRepository,
     ILoggerFactory loggerFactory,
     ChannelProvider channelProvider,
     IOptions <Config> config,
     RepositoryProvider repositoryProvider,
     EventAggregator eventAggregator
     )
 {
     _nbXplorerClientProvider = nbXplorerClientProvider;
     _networkProvider         = networkProvider;
     _keysRepository          = keysRepository;
     _loggerFactory           = loggerFactory;
     _logger             = loggerFactory.CreateLogger <PeerManagerProvider>();
     _channelProvider    = channelProvider;
     _config             = config;
     _repositoryProvider = repositoryProvider;
     _eventAggregator    = eventAggregator;
 }
コード例 #5
0
 public RustLightningEventReactor(
     P2PConnectionHandler connectionHandler,
     PeerManagerProvider peerManagerProvider,
     IWalletService walletService,
     NRustLightningNetwork network,
     EventAggregator eventAggregator,
     ILogger logger,
     InvoiceService invoiceService,
     ChannelProvider channelProvider,
     IRepository repository)
 {
     _pool = MemoryPool <byte> .Shared;
     _connectionHandler   = connectionHandler;
     _peerManagerProvider = peerManagerProvider;
     _walletService       = walletService;
     _network             = network;
     _eventAggregator     = eventAggregator;
     _logger          = logger;
     _invoiceService  = invoiceService;
     _channelProvider = channelProvider;
     _repository      = repository;
 }