예제 #1
0
        public OSTestHelper(IOsBlockchainNodeContextService osBlockchainNodeContextService,
                            IAccountService accountService,
                            IMinerService minerService,
                            IBlockchainService blockchainService,
                            ITxHub txHub,
                            ISmartContractAddressService smartContractAddressService,
                            IBlockAttachService blockAttachService,
                            IStaticChainInformationProvider staticChainInformationProvider,
                            ITransactionResultService transactionResultService,
                            IOptionsSnapshot <ChainOptions> chainOptions)
        {
            _chainOptions = chainOptions.Value;
            _osBlockchainNodeContextService = osBlockchainNodeContextService;
            _accountService              = accountService;
            _minerService                = minerService;
            _blockchainService           = blockchainService;
            _smartContractAddressService = smartContractAddressService;
            _blockAttachService          = blockAttachService;
            _txHub = txHub;
            _staticChainInformationProvider = staticChainInformationProvider;
            _transactionResultService       = transactionResultService;

            BestBranchBlockList     = new List <Block>();
            ForkBranchBlockList     = new List <Block>();
            UnlinkedBranchBlockList = new List <Block>();
        }
예제 #2
0
 public void Init()
 {
     _transactionVerifier = Services.GetService <ITransactionVerifier>();
     _difficultyService   = Services.GetService <IDifficultyService>();
     _blockChainService   = Services.GetService <IBlockChainService>();
     _minerService        = Services.GetService <IMinerService>();
 }
 public DataSynchronizerWorker(ISettingsService settingsService, IMinerService minerService, ISnapshotService snapshotService, IServerService serverService, ILogger <DataSynchronizerWorker> logger)
 {
     _settingsService = settingsService;
     _minerService    = minerService;
     _snapshotService = snapshotService;
     _serverService   = serverService;
     _logger          = logger;
 }
예제 #4
0
 public BlockMiningEventHandler(IMinerService minerService, IBlockAttachService blockAttachService,
                                ITaskQueueManager taskQueueManager)
 {
     _minerService       = minerService;
     _blockAttachService = blockAttachService;
     _taskQueueManager   = taskQueueManager;
     Logger = NullLogger <BlockMiningEventHandler> .Instance;
 }
예제 #5
0
 public MinerServiceTests()
 {
     _transactionPoolService           = GetRequiredService <ITransactionPoolService>();
     _blockTransactionLimitProvider    = GetRequiredService <IBlockTransactionLimitProvider>();
     _transactionPackingOptionProvider = GetRequiredService <ITransactionPackingOptionProvider>();
     _minerService        = GetRequiredService <IMinerService>();
     _blockStateSetManger = GetRequiredService <IBlockStateSetManger>();
     _blockchainService   = GetRequiredService <IBlockchainService>();
     _kernelTestHelper    = GetRequiredService <KernelTestHelper>();
 }
예제 #6
0
 public ConsensusRequestMiningEventHandler(IMinerService minerService, IBlockAttachService blockAttachService,
                                           ITaskQueueManager taskQueueManager, IBlockchainService blockchainService)
 {
     _minerService       = minerService;
     _blockAttachService = blockAttachService;
     _taskQueueManager   = taskQueueManager;
     _blockchainService  = blockchainService;
     Logger        = NullLogger <ConsensusRequestMiningEventHandler> .Instance;
     LocalEventBus = NullLocalEventBus.Instance;
 }
예제 #7
0
 public DataCollectorWorker(
     IMinerService minerService,
     ISnapshotService snapshotService,
     IRemoteManagementClientFactory clientFactory,
     ILogger <DataCollectorWorker> logger)
 {
     _minerService    = minerService;
     _snapshotService = snapshotService;
     _clientFactory   = clientFactory;
     _logger          = logger;
 }
        public ConsensusRequestMiningEventHandler(IServiceProvider serviceProvider)
        {
            _minerService       = serviceProvider.GetService <IMinerService>();
            _blockAttachService = serviceProvider.GetService <IBlockAttachService>();
            _taskQueueManager   = serviceProvider.GetService <ITaskQueueManager>();
            _blockchainService  = serviceProvider.GetService <IBlockchainService>();
            _consensusService   = serviceProvider.GetService <IConsensusService>();

            Logger        = NullLogger <ConsensusRequestMiningEventHandler> .Instance;
            LocalEventBus = NullLocalEventBus.Instance;
        }
예제 #9
0
        public async Task GlobalSetup()
        {
            _blockchainService      = GetRequiredService <IBlockchainService>();
            _osTestHelper           = GetRequiredService <OSTestHelper>();
            _minerService           = GetRequiredService <IMinerService>();
            _blockStateSets         = GetRequiredService <INotModifiedCachedStateStore <BlockStateSet> >();
            _transactionManager     = GetRequiredService <ITransactionManager>();
            _transactionPoolService = GetRequiredService <ITransactionPoolService>();

            _transactions = new List <Transaction>();
            _chain        = await _blockchainService.GetChainAsync();
        }
예제 #10
0
 public ParallelTests()
 {
     _blockchainService        = GetRequiredService <IBlockchainService>();
     _blockExecutingService    = GetRequiredService <IBlockExecutingService>();
     _minerService             = GetRequiredService <IMinerService>();
     _transactionResultManager = GetRequiredService <ITransactionResultManager>();
     _grouper            = GetRequiredService <ITransactionGrouper>();
     _codeRemarksManager = GetRequiredService <ICodeRemarksManager>();
     _txHub = GetRequiredService <ITxHub>();
     _blockAttachService = GetRequiredService <IBlockAttachService>();
     _accountService     = GetRequiredService <IAccountService>();
     _parallelTestHelper = GetRequiredService <ParallelTestHelper>();
 }
        public void GlobalSetup()
        {
            _blockchainService     = GetRequiredService <IBlockchainService>();
            _blockExecutingService = GetRequiredService <IBlockExecutingService>();
            _minerService          = GetRequiredService <IMinerService>();
            _blockStateSets        = GetRequiredService <INotModifiedCachedStateStore <BlockStateSet> >();
            _osTestHelper          = GetRequiredService <OSTestHelper>();

            _prepareTransactions     = new List <Transaction>();
            _systemTransactions      = new List <Transaction>();
            _cancellableTransactions = new List <Transaction>();
            _keyPairs = new List <ECKeyPair>();
        }
예제 #12
0
 public AlertScanWorker(
     IAlertDefinitionService alertDefinitionService,
     IAlertService alertService,
     ISnapshotService snapshotService,
     IMinerService minerService,
     IScanFactory scanFactory,
     ILogger <AlertScanWorker> logger)
 {
     _alertDefinitionService = alertDefinitionService;
     _alertService           = alertService;
     _snapshotService        = snapshotService;
     _minerService           = minerService;
     _scanFactory            = scanFactory;
     _logger = logger;
 }
예제 #13
0
 public ParallelTestHelper(IOsBlockchainNodeContextService osBlockchainNodeContextService,
                           IAccountService accountService,
                           IMinerService minerService,
                           IBlockchainService blockchainService,
                           ITxHub txHub,
                           ISmartContractAddressService smartContractAddressService,
                           IBlockAttachService blockAttachService,
                           IStaticChainInformationProvider staticChainInformationProvider,
                           ITransactionResultService transactionResultService,
                           IOptionsSnapshot <ChainOptions> chainOptions) : base(osBlockchainNodeContextService, accountService,
                                                                                minerService, blockchainService, txHub, smartContractAddressService, blockAttachService,
                                                                                staticChainInformationProvider, transactionResultService, chainOptions)
 {
     _accountService = accountService;
     _staticChainInformationProvider = staticChainInformationProvider;
 }
예제 #14
0
 public CollectorService(
     UserManager <MiningMonitorUser> userManager,
     ILoginService loginService,
     IMinerService minerService,
     ISnapshotService snapshotService,
     IMapper <MiningMonitorUser, Collector> collectorMapper,
     IUpdateMapper <Collector, MiningMonitorUser> userMapper,
     IMapper <IdentityResult, ModelStateDictionary> resultMapper)
 {
     _userManager     = userManager;
     _loginService    = loginService;
     _minerService    = minerService;
     _snapshotService = snapshotService;
     _collectorMapper = collectorMapper;
     _userMapper      = userMapper;
     _resultMapper    = resultMapper;
 }
예제 #15
0
        public void Setup(BenchmarkContext context)
        {
            _blockchainService  = GetRequiredService <IBlockchainService>();
            _osTestHelper       = GetRequiredService <OSTestHelper>();
            _minerService       = GetRequiredService <IMinerService>();
            _txHub              = GetRequiredService <ITxHub>();
            _blockAttachService = GetRequiredService <IBlockAttachService>();

            _counter = context.GetCounter("TestCounter");

            AsyncHelper.RunSync(async() =>
            {
                var transactions = await _osTestHelper.GenerateTransferTransactions(1000);

                await _osTestHelper.BroadcastTransactions(transactions);
            });
        }
예제 #16
0
        public void Init()
        {
            _blockChainPath      = Configurations.CurrentPath + "\\BlockChain\\";
            _blockChainFullPath  = $"{_blockChainPath}\\Chain\\";
            _blockInfoDbFullPath = _blockChainPath + "\\Data\\BlockInfo.sqlite";

            _logger = Services.GetService <ILogger>();
            _transactionVerifier = Services.GetService <ITransactionVerifier>();
            _blockVerifier       = Services.GetService <IBlockVerifier>();
            _server       = Services.GetService <IP2PServer>();
            _eventManager = Services.GetService <IEventManager>();
            _eventManager.RegisterEventListener(OnNewBlock, EventTypes.EventType.NewBlock);
            _mappingService = Services.GetService <IMappingService>();
            _minerService   = Services.GetService <IMinerService>();
            _walletService  = Services.GetService <IWalletService>();

            TryConnectToBlockInfoDb();
            TryLoadSavedInfo();
            _askedForRequests = new List <InvitationRequest>();
        }
예제 #17
0
        public void Init()
        {
            _logger            = Services.GetService <ILogger>();
            _unspentDbFullPath = $"{Configurations.CurrentPath}\\BlockChain\\Data\\Unspent.sqlite";

            var ev = Services.GetService <IEventManager>();

            ev.RegisterEventListener(OnNewBlock, EventTypes.EventType.NewVerifiedBlock);
            ev.RegisterEventListener(OnNewTransaction, EventTypes.EventType.NewTransaction);

            _blockChainService = Services.GetService <IBlockChainService>();
            _minerService      = Services.GetService <IMinerService>();
            _mappingService    = Services.GetService <IMappingService>();

            TryConnectToUnspentDB();

            if (!IsLoadedIn(_blockChainService.Info.EndOfLongestChain))
            {
                _logger.Log("Need to backload the Unspent db for some reasons");
                LoadEveryNewBlock();
            }
        }
예제 #18
0
        public void Init()
        {
            _logger            = Services.GetService <ILogger>();
            _mappingService    = Services.GetService <IMappingService>();
            _server            = Services.GetService <IP2PServer>();
            _minerService      = Services.GetService <IMinerService>();
            _eventManager      = Services.GetService <IEventManager>();
            _blockChainService = Services.GetService <IBlockChainService>();

            _catchDataFullPath = $"{Configurations.CurrentPath}\\BlockChain\\Catchup";
            _logger.Log("Ketchup started to flow ....", 1);
            CaughtUp               = false;
            bufferedTransactions   = new List <Transaction>();
            bufferedBlockInfos     = new List <BlockInfo>();
            supposedLongestBlockId = "";
            shouldTryEnd           = false;
            LastGotResponse        = DateTime.UtcNow;

            if (!Directory.Exists(_catchDataFullPath))
            {
                Directory.CreateDirectory(_catchDataFullPath);
            }
        }
 public HomeController(IMinerService minerServ, IUserService userService)
 {
     this.minerService = minerServ;
     this.userService  = userService;
 }
예제 #20
0
 public MiningRequestService(IMinerService minerService)
 {
     _minerService = minerService;
 }
예제 #21
0
 public MinersController(IMinerService minerService, ICollectorService collectorService)
 {
     _minerService     = minerService;
     _collectorService = collectorService;
 }
예제 #22
0
 public MinerServiceTests()
 {
     _chainService = GetRequiredService <IBlockchainService>();
     _minerService = GetRequiredService <IMinerService>();
 }
 public MiningTxHubBenchmark()
 {
     _minerService       = GetRequiredService <IMinerService>();
     _transactionManager = GetRequiredService <ITransactionManager>();
 }
예제 #24
0
 public BlockTemplateMinerService(IMinerService minerService, IAccountService accountService)
 {
     _minerService   = minerService;
     _accountService = accountService;
 }