public NotificationService(IOptionsMonitor <AppSettings> options, ILogger <NotificationService> logger,
                            IEventBus eventBus, INotificationsHandler notificationsHandler, ITxRepository txRepository) : base(logger, eventBus)
 {
     this.notificationsHandler = notificationsHandler ?? throw new ArgumentNullException(nameof(notificationsHandler));
     this.txRepository         = txRepository ?? throw new ArgumentNullException(nameof(txRepository));
     notificationSettings      = options.CurrentValue.Notification;
 }
 public InvalidTxHandler(ITxRepository txRepository, ILogger <InvalidTxHandler> logger, IEventBus eventBus, IBlockParser blockParser, IClock clock)
     : base(logger, eventBus)
 {
     this.txRepository = txRepository ?? throw new ArgumentNullException(nameof(txRepository));
     this.blockParser  = blockParser ?? throw new ArgumentNullException(nameof(blockParser));
     this.clock        = clock ?? throw new ArgumentNullException(nameof(clock));
 }
 public CleanUpTxHandler(ITxRepository txRepository, ILogger <CleanUpTxHandler> logger, IOptions <AppSettings> options)
 {
     this.txRepository  = txRepository ?? throw new ArgumentNullException(nameof(txRepository));
     this.logger        = logger ?? throw new ArgumentNullException(nameof(logger));
     cleanUpTxPeriodSec = options.Value.CleanUpTxPeriodSec;
     cleanUpTxAfterDays = options.Value.CleanUpTxAfterDays;
 }
Пример #4
0
 public BlockParser(IRpcMultiClient rpcMultiClient, ITxRepository txRepository, ILogger <BlockParser> logger,
                    IEventBus eventBus, IOptions <AppSettings> options, IClock clock)
     : base(logger, eventBus)
 {
     this.rpcMultiClient = rpcMultiClient ?? throw new ArgumentNullException(nameof(rpcMultiClient));
     this.txRepository   = txRepository ?? throw new ArgumentNullException(nameof(txRepository));
     this.clock          = clock ?? throw new ArgumentNullException(nameof(clock));
     appSettings         = options.Value;
 }
Пример #5
0
 public Mapi(IRpcMultiClient rpcMultiClient, IFeeQuoteRepository feeQuoteRepository, IBlockChainInfo blockChainInfo, IMinerId minerId, ITxRepository txRepository, ILogger <Mapi> logger, IClock clock)
 {
     this.rpcMultiClient     = rpcMultiClient ?? throw new ArgumentNullException(nameof(rpcMultiClient));
     this.feeQuoteRepository = feeQuoteRepository ?? throw new ArgumentNullException(nameof(feeQuoteRepository));
     this.blockChainInfo     = blockChainInfo ?? throw new ArgumentNullException(nameof(blockChainInfo));
     this.minerId            = minerId ?? throw new ArgumentException(nameof(minerId));
     this.txRepository       = txRepository ?? throw new ArgumentException(nameof(txRepository));
     this.logger             = logger ?? throw new ArgumentException(nameof(logger));
     this.clock = clock ?? throw new ArgumentNullException(nameof(clock));
 }
 public BlockChecker(IEventBus eventBus, ITxRepository txRepository, ILogger <BlockChecker> logger, IOptions <AppSettings> options)
 {
     this.eventBus     = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
     this.txRepository = txRepository ?? throw new ArgumentNullException(nameof(txRepository));
     this.logger       = logger ?? throw new ArgumentNullException(nameof(logger));
     if (options == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     appSettings = options.Value;
 }
Пример #7
0
 public DsntController(ITxRepository txRepository, IRpcMultiClient rpcMultiClient, ITransactionRequestsCheck transactionRequestsCheck, IHostBanList banList,
                       IClock clock, IOptions <AppSettings> options, IEventBus eventBus, ILogger <DsntController> logger)
 {
     this.txRepository             = txRepository ?? throw new ArgumentNullException(nameof(txRepository));
     this.rpcMultiClient           = rpcMultiClient ?? throw new ArgumentNullException(nameof(rpcMultiClient));
     this.clock                    = clock ?? throw new ArgumentNullException(nameof(clock));
     this.transactionRequestsCheck = transactionRequestsCheck ?? throw new ArgumentNullException(nameof(transactionRequestsCheck));
     this.banList                  = banList ?? throw new ArgumentNullException(nameof(banList));
     this.eventBus                 = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
     this.logger                   = logger ?? throw new ArgumentNullException(nameof(logger));
     appSettings                   = options.Value;
 }
        public override void TestInitialize()
        {
            base.TestInitialize();
            zmqService   = server.Services.GetRequiredService <ZMQSubscriptionService>();
            txRepository = server.Services.GetRequiredService <ITxRepository>();

            ApiKeyAuthentication = AppSettings.RestAdminAPIKey;
            InsertFeeQuote();

            // Wait until all events are processed to avoid race conditions - we need to  finish subscribing to ZMQ before checking for any received notifications
            WaitUntilEventBusIsIdle();
        }
Пример #9
0
        public NotificationsHandler(ILogger <NotificationsHandler> logger, INotificationServiceHttpClientFactory httpClientFactory, IOptions <AppSettings> options,
                                    ITxRepository txRepository, IRpcMultiClient rpcMultiClient, IMinerId minerId, IClock clock)
        {
            this.logger            = logger ?? throw new ArgumentNullException(nameof(logger));
            this.httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
            this.txRepository      = txRepository ?? throw new ArgumentNullException(nameof(txRepository));
            this.rpcMultiClient    = rpcMultiClient ?? throw new ArgumentNullException(nameof(rpcMultiClient));
            this.minerId           = minerId ?? throw new ArgumentNullException(nameof(minerId));
            notificationSettings   = options.Value.Notification;
            var maxNumberOfSlowNotifications = notificationSettings.InstantNotificationsQueueSize.Value * notificationSettings.InstantNotificationsSlowTaskPercentage / 100;

            notificationScheduler = new NotificationScheduler(logger, maxNumberOfSlowNotifications, notificationSettings.InstantNotificationsQueueSize.Value,
                                                              notificationSettings.MaxNotificationsInBatch.Value, notificationSettings.NoOfSavedExecutionTimes.Value,
                                                              notificationSettings.SlowHostThresholdInMs.Value);
            this.clock = clock ?? throw new ArgumentNullException(nameof(clock));
        }
Пример #10
0
 public CleanUpTxWithPauseHandlerForTest(IEventBus eventBus, ITxRepository txRepository, ILogger <CleanUpTxHandler> logger, IOptions <AppSettings> options, IClock clock)
     : base(txRepository, logger, options)
 {
     this.eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
     this.clock    = clock ?? throw new ArgumentNullException(nameof(clock));
 }