Beispiel #1
0
        public async Task <BlockchainNodeContext> StartAsync(BlockchainNodeContextStartDto dto)
        {
            _defaultContractZeroCodeProvider.SetDefaultContractZeroRegistrationByType(dto.ZeroSmartContractType);

            var context = new BlockchainNodeContext
            {
                ChainId = dto.ChainId,
                TxHub   = _txHub,
            };
            var chain = await _blockchainService.GetChainAsync();

            chain = chain == null
                ? await _chainCreationService.CreateNewChainAsync(dto.Transactions)
                : await _blockchainService.ResetChainToLibAsync(chain);

            await _smartContractAddressUpdateService.UpdateSmartContractAddressesAsync(
                await _blockchainService.GetBlockHeaderByHashAsync(chain.BestChainHash));

            await _consensusService.TriggerConsensusAsync(new ChainContext
            {
                BlockHash   = chain.BestChainHash,
                BlockHeight = chain.BestChainHeight
            });

            return(context);
        }
Beispiel #2
0
 public async Task StopAsync(BlockchainNodeContext blockchainNodeContext)
 {
 }
 public Task StopAsync(BlockchainNodeContext blockchainNodeContext)
 {
     return(Task.CompletedTask);
 }