コード例 #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);
        }
コード例 #2
0
 public async Task StopAsync(BlockchainNodeContext blockchainNodeContext)
 {
 }
コード例 #3
0
 public Task StopAsync(BlockchainNodeContext blockchainNodeContext)
 {
     return(Task.CompletedTask);
 }