Ejemplo n.º 1
0
        public Task <GetSyncStateAPIResult> GetSyncState()
        {
            var result = new GetSyncStateAPIResult
            {
                ResultCode        = APIResultCodes.Success,
                Mode              = BlockChain.Singleton.InSyncing ? ConsensusWorkingMode.OutofSyncWaiting : ConsensusWorkingMode.Normal,
                NewestBlockUIndex = BlockChain.Singleton.GetNewestBlockUIndex()
            };

            return(Task.FromResult(result));
        }
Ejemplo n.º 2
0
        public async Task <GetSyncStateAPIResult> GetSyncState()
        {
            var consBlock = await BlockChain.Singleton.GetLastConsolidationBlockAsync();

            var result = new GetSyncStateAPIResult
            {
                ResultCode            = APIResultCodes.Success,
                NetworkID             = BlockChain.Singleton.NetworkID,
                SyncState             = BlockChain.Singleton.CurrentState == BlockChainState.Almighty ? ConsensusWorkingMode.Normal : ConsensusWorkingMode.OutofSyncWaiting,
                LastConsolidationHash = consBlock == null ? null : consBlock.Hash,
                //NewestBlockUIndex = await BlockChain.Singleton.GetNewestBlockUIndexAsync(),
                Status = await BlockChain.Singleton.GetNodeStatusAsync()
            };

            return(result);
        }