/// <summary> /// check 2 db has the same sync index /// </summary> public void InitConsistencyCheck() { var levelMax = _leveldb.GetMaxSyncIndex(_sqldb.Identity); var sqlMax = _sqldb.GetMaxSyncIndex(); if (levelMax == sqlMax) { return; } if ((levelMax == null && sqlMax == 0) || levelMax < sqlMax) { // try repair sync height // when last sync: sqldb save successfully, but leveldb fails _leveldb.AddSyncIndex(_sqldb.Identity, sqlMax.Value); _leveldb.Commit(); return; } //throw new Exception("track db damaged!"); }
void IPersistencePlugin.OnCommit(NeoSystem system, Block block, DataCache snapshot) { _levelDb.Commit(); }