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)); }
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); }