public async Task ParallelExecuteAsync_Test() { var chain = await BlockchainService.GetChainAsync(); (PrepareTransactions, KeyPairs) = await OsTestHelper.PrepareTokenForParallel(10); Block = OsTestHelper.GenerateBlock(chain.BestChainHash, chain.BestChainHeight, PrepareTransactions); //await BlockExecutingService.ExecuteBlockAsync(Block.Header, PrepareTransactions); await OsTestHelper.BroadcastTransactions(PrepareTransactions); Block = await MinerService.MineAsync(chain.BestChainHash, chain.BestChainHeight, TimestampHelper.GetUtcNow(), TimestampHelper.DurationFromSeconds(4)); await BlockchainService.AddBlockAsync(Block); await BlockAttachService.AttachBlockAsync(Block); SystemTransactions = await OsTestHelper.GenerateTransferTransactions(1); CancellableTransactions = OsTestHelper.GenerateTransactionsWithoutConflict(KeyPairs); Block = OsTestHelper.GenerateBlock(Block.GetHash(), Block.Height, SystemTransactions.Concat(CancellableTransactions)); await OsTestHelper.BroadcastTransactions(SystemTransactions.Concat(CancellableTransactions)); var block = await BlockExecutingService.ExecuteBlockAsync(Block.Header, SystemTransactions, CancellableTransactions, CancellationToken.None); block.TransactionIds.Count().ShouldBeGreaterThan(10); }
public void SetHash() { Hash = MinerService.GetHash(this); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Hash))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsBlockValid))); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PreviousHash))); }
public PoolController(CustomizationOption customizationOptions, MinerContext dbContext, PlotService plotService, PlotterService plotterService, MinerService minerService) { CustomizationOptions = customizationOptions; DbContext = dbContext; PlotService = plotService; PlotterService = plotterService; MinerService = minerService; }
private void Mine_Click(object sender, RoutedEventArgs e) { if (this.DataContext is Blockchain.Models.Block block) { var nonce = MinerService.GetGoalNonce(block); block.SetNonce(nonce); } }
public Logger(Context context, ILoggerFactory loggerFactory, LogFilter logFilter, WalletStore walletStore, WalletService walletService, BlockMiner blockMiner, ChainService chainService, NodeConnectionService nodeConnectionService, MinerService minerService) : base(context) { this.context = context; this.logFilter = logFilter; this.walletStore = walletStore; this.walletService = walletService; this.blockMiner = blockMiner; this.chainService = chainService; this.nodeConnectionService = nodeConnectionService; this.minerService = minerService; this.logger = loggerFactory.CreateLogger <Staker>(); }
public void Setup() { _ms = new MemoryStream(); _memoryDb = new LiteDatabase(_ms); _userCollection = _memoryDb.GetCollection <MiningMonitorUser>(); _userStoreLogger = new Mock <ILogger <MiningMonitorUserStore> >(); _userStore = new MiningMonitorUserStore(new LiteDbRepository <MiningMonitorUser, Guid>(_userCollection), _userStoreLogger.Object); _optionsAccessor = new Mock <IOptions <IdentityOptions> >(); _passwordHasher = new Mock <IPasswordHasher <MiningMonitorUser> >(); _normalizer = new Mock <ILookupNormalizer>(); _serviceProvider = new Mock <IServiceProvider>(); _userManagerLogger = new Mock <ILogger <UserManager <MiningMonitorUser> > >(); _userManager = new UserManager <MiningMonitorUser>(_userStore, _optionsAccessor.Object, _passwordHasher.Object, Enumerable.Empty <IUserValidator <MiningMonitorUser> >(), Enumerable.Empty <IPasswordValidator <MiningMonitorUser> >(), _normalizer.Object, new IdentityErrorDescriber(), _serviceProvider.Object, _userManagerLogger.Object); _httpContextAccessor = new Mock <IHttpContextAccessor>(); _signinManagerLogger = new Mock <ILogger <SignInManager <MiningMonitorUser> > >(); _userFactory = new Mock <IUserClaimsPrincipalFactory <MiningMonitorUser> >(); _authSchemeProvider = new Mock <IAuthenticationSchemeProvider>(); _signinManager = new SignInManager <MiningMonitorUser>(_userManager, _httpContextAccessor.Object, _userFactory.Object, _optionsAccessor.Object, _signinManagerLogger.Object, _authSchemeProvider.Object); _loginService = new LoginService(_signinManager); _snapshotCollection = _memoryDb.GetCollection <Snapshot>(); _snapshotService = new SnapshotService(new LiteDbRepository <Snapshot, Guid>(_snapshotCollection)); _minerCollection = _memoryDb.GetCollection <Miner>(); _minerService = new MinerService(new LiteDbRepository <Miner, Guid>(_minerCollection), _snapshotService); _userMapper = new UserMapper(); _resultMapper = new IdentityResultMapper(); _subject = new CollectorService(_userManager, _loginService, _minerService, _snapshotService, _userMapper, _userMapper, _resultMapper); }
public MinerHub(MinerService minerService) { MinerService = minerService; }
public MinerController(MinerContext dbContext, MinerService minerService, CustomizationOption customizationOptions) { DbContext = dbContext; MinerService = minerService; CustomizationOptions = customizationOptions; }
public void Initialize() { minerService = new MinerService(); }
public BlockChainController(MinerService minerService) { _minerService = minerService; }
public MinerController(MinerContext dbContext, MinerService minerService) { DbContext = dbContext; MinerService = minerService; }
public MinerController(MinerService minerservice) { _minerservice = minerservice; }