Skip to content

Commit

Permalink
Minor fix on storage state dumper parameter HeightToStartRealTimeSync…
Browse files Browse the repository at this point in the history
…ing (#91)

* Minor fix on storage state dumper parameter HeightToStartRealTimeSyncing

* Update StatesDumper/StatesDumper.cs

Co-Authored-By: vncoelho <[email protected]>
  • Loading branch information
vncoelho authored Apr 30, 2019
1 parent 9ae210f commit 14eb335
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions StatesDumper/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class Settings
/// <summary>
/// Height to begin real-time syncing and dumping on, consequently, dumping every block into a single files
/// </summary>
public uint HeightToStartRealTimeSyncing { get; }
public int HeightToStartRealTimeSyncing { get; }
/// <summary>
/// Persisting actions
/// </summary>
Expand All @@ -29,7 +29,7 @@ private Settings(IConfigurationSection section)
/// Geting settings for storage changes state dumper
this.BlockCacheSize = GetValueOrDefault(section.GetSection("BlockCacheSize"), 1000u, p => uint.Parse(p));
this.HeightToBegin = GetValueOrDefault(section.GetSection("HeightToBegin"), 0u, p => uint.Parse(p));
this.HeightToStartRealTimeSyncing = GetValueOrDefault(section.GetSection("HeightToStartRealTimeSyncing"), 2883000u, p => uint.Parse(p));
this.HeightToStartRealTimeSyncing = GetValueOrDefault(section.GetSection("HeightToStartRealTimeSyncing"), -1, p => int.Parse(p));
this.PersistAction = GetValueOrDefault(section.GetSection("PersistAction"), PersistActions.StorageChanges, p => (PersistActions)Enum.Parse(typeof(PersistActions), p));
}

Expand Down
2 changes: 1 addition & 1 deletion StatesDumper/StatesDumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public void OnCommitStorage(Snapshot snapshot)
uint blockIndex = snapshot.Height;
if (bs_cache.Count > 0)
{
if ((blockIndex % Settings.Default.BlockCacheSize == 0) || (blockIndex > Settings.Default.HeightToStartRealTimeSyncing))
if ((blockIndex % Settings.Default.BlockCacheSize == 0) || (Settings.Default.HeightToStartRealTimeSyncing != -1 && blockIndex >= Settings.Default.HeightToStartRealTimeSyncing))
{
string dirPath = "./Storage";
Directory.CreateDirectory(dirPath);
Expand Down
2 changes: 1 addition & 1 deletion StatesDumper/StatesDumper/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"PersistAction": "StorageChanges",
"BlockCacheSize": 1000,
"HeightToBegin": 0,
"HeightToRealTimeSyncing": 2883000
"HeightToStartRealTimeSyncing": -1
}
}

0 comments on commit 14eb335

Please sign in to comment.