Browse Source

Improved: save safebox when restoring from file

Will save lasts 2 safeboxs when restoring from file
PascalCoin 6 years ago
parent
commit
8a0cb3c000
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/core/UBlockChain.pas

+ 2 - 1
src/core/UBlockChain.pas

@@ -697,7 +697,8 @@ begin
                 break;
               end else begin
                 // To prevent continuous saving...
-                If (BlocksCount MOD (CT_BankToDiskEveryNBlocks*10))=0 then begin
+                if ((BlocksCount+(CT_BankToDiskEveryNBlocks*2)) >= Storage.LastBlock ) or
+                   ((BlocksCount MOD (CT_BankToDiskEveryNBlocks*10))=0) then begin
                   Storage.SaveBank;
                 end;
                 if (Assigned(restoreProgressNotify)) And (TPlatform.GetElapsedMilliseconds(tc)>1000) then begin