Only save cache on new block when in sync.

This commit is contained in:
softsimon
2021-01-22 23:20:39 +07:00
parent d3a6dc8856
commit ccec935193

View File

@@ -116,9 +116,11 @@ class Blocks {
if (this.newBlockCallbacks.length) { if (this.newBlockCallbacks.length) {
this.newBlockCallbacks.forEach((cb) => cb(blockExtended, txIds, transactions)); this.newBlockCallbacks.forEach((cb) => cb(blockExtended, txIds, transactions));
} }
if (memPool.isInSync()) {
diskCache.$saveCacheToDisk(); diskCache.$saveCacheToDisk();
} }
} }
}
public getLastDifficultyAdjustmentTime(): number { public getLastDifficultyAdjustmentTime(): number {
return this.lastDifficultyAdjustmentTime; return this.lastDifficultyAdjustmentTime;