private NxtWalletDb InitWallet(string walletfile) { var wallet = new NxtWalletDb(walletfile); if (wallet.IsInitialized()) { return(wallet); } var blockchainStatus = serverInfoService.GetBlockchainStatus().Result; wallet.Init(blockchainStatus.LastBlockId); return(wallet); }
public async Task <BlockchainStatus> GetBlockchainStatus() { var status = new BlockchainStatus(); var blockchainStatusReply = await _serverInfoService.GetBlockchainStatus(); var lastBlock = await _blockService.GetBlock(BlockLocator.ByBlockId(blockchainStatusReply.LastBlockId)); var confirmedBlock = await _blockService.GetBlock(BlockLocator.ByHeight(blockchainStatusReply.NumberOfBlocks - 11)); var secureBlock = await _blockService.GetBlock(BlockLocator.ByHeight(blockchainStatusReply.NumberOfBlocks - 721)); status.LastKnownBlockId = blockchainStatusReply.LastBlockId.ToSigned(); status.LastKnownBlockTimestamp = lastBlock.Timestamp; status.LastConfirmedBlockId = confirmedBlock.BlockId.ToSigned(); status.LastConfirmedBlockTimestamp = confirmedBlock.Timestamp; status.LastSecureBlockId = secureBlock.BlockId.ToSigned(); status.LastSecureBlockTimestamp = secureBlock.Timestamp; return(status); }
public GetBlockchainStatusTest(IServerInfoService serverInfoService, ILogger logger) { _logger = logger; _getBlockchainStatusReply = serverInfoService.GetBlockchainStatus().Result; }