public async Task Start() { _running = true; _scanHeight = _db.GetMaxSyncIndex() ?? 0; while (_running) { try { if (await Sync(_scanHeight)) { _scanHeight++; } if (_scanHeight > Blockchain.Singleton.Height) { await Task.Delay(TimeSpan.FromSeconds(5)); } } catch (Exception e) { Console.WriteLine(e); throw; } } }
public async Task <object> GetSync() { using var db = new TrackDB(); return(db.GetMaxSyncIndex()); }