Ejemplo n.º 1
0
        private async Task GetDataFromNxtServer()
        {
            _lastBalanceMatchBlock = await _nxtServer.GetBlockAsync(_walletRepository.LastBalanceMatchBlockId);

            _blockchainStatus = await _nxtServer.GetBlockchainStatusAsync();

            _nxtTransactions      = (await _nxtServer.GetTransactionsAsync(_lastBalanceMatchBlock.Timestamp)).ToList();
            UnconfirmedBalanceNqt = await _nxtServer.GetUnconfirmedNqtBalanceAsync();
        }
Ejemplo n.º 2
0
        private async Task <Tuple <BlockchainStatus, Block <ulong> > > SyncToLastCommonBlock()
        {
            Block <ulong>    lastKnownBlock   = null;
            BlockchainStatus blockchainStatus = null;

            while (lastKnownBlock == null)
            {
                try
                {
                    blockchainStatus = await _nxtServer.GetBlockchainStatusAsync();

                    lastKnownBlock = await _nxtServer.GetBlockAsync(_walletRepository.LastLedgerEntryBlockId);
                }
                catch (NxtException e)
                {
                    if (e.Message != "Unknown block")
                    {
                        throw;
                    }
                    await RollbackToPreviousHeight();
                }
            }
            return(new Tuple <BlockchainStatus, Block <ulong> >(blockchainStatus, lastKnownBlock));
        }