Browse Source

Allow configure MinFutureBlocksToDownloadNewSafebox on Daemon

Disabled by defeault on dameon, use MINPENDINGBLOCKSTODOWNLOADCHECKPOINT on ini file
PascalCoin 6 years ago
parent
commit
600b2674e5
3 changed files with 13 additions and 1 deletions
  1. 1 0
      README.md
  2. 5 0
      src/core/upcdaemon.pas
  3. 7 1
      src/pascalcoin_daemon.ini

+ 1 - 0
README.md

@@ -40,6 +40,7 @@ Also, consider a donation at PascalCoin development account: "0-10"
 - Fixed a decompression bug caused by FreePascal "paszlib" package bug on version 3.0.4 -> https://bugs.freepascal.org/view.php?id=34422
 - Allow download new safebox (instead of download pending blocks) when difference > TNode.MinFutureBlocksToDownloadNewSafebox
   - 7 days by default for Production, 1 for Testnet
+  - Disabled by default on Daemon, configure on INI file with MINPENDINGBLOCKSTODOWNLOADCHECKPOINT
   - Will not delete current blockchain, but will not download pending blocks between last block saved and current network checkpoint block
 - Allow only connections using Net protocol >= 9  (Introduced on Build 4.0.1)
 - Fill automatic params at "buyaccount" RPC call: Will set 'price' and 'seller_account' values to current safebox values if not provided

+ 5 - 0
src/core/upcdaemon.pas

@@ -41,6 +41,8 @@ Const
   CT_INI_IDENT_MINER_MAX_CONNECTIONS = 'RPC_SERVERMINER_MAX_CONNECTIONS';
   CT_INI_IDENT_MINER_MAX_OPERATIONS_PER_BLOCK = 'RPC_SERVERMINER_MAX_OPERATIONS_PER_BLOCK';
   CT_INI_IDENT_MINER_MAX_ZERO_FEE_OPERATIONS  = 'RPC_SERVERMINER_MAX_ZERO_FEE_OPERATIONS';
+  CT_INI_IDENT_LOWMEMORY = 'LOWMEMORY';
+  CT_INI_IDENT_MINPENDINGBLOCKSTODOWNLOADCHECKPOINT = 'MINPENDINGBLOCKSTODOWNLOADCHECKPOINT';
 
 Type
   { TPCDaemonThread }
@@ -211,6 +213,9 @@ begin
         // Check Database
         FNode.Bank.StorageClass := TFileStorage;
         TFileStorage(FNode.Bank.Storage).DatabaseFolder := TFolderHelper.GetPascalCoinDataFolder+PathDelim+'Data';
+        TFileStorage(FNode.Bank.Storage).LowMemoryUsage := FIniFile.ReadBool(CT_INI_SECTION_GLOBAL,CT_INI_IDENT_LOWMEMORY,False);
+        // By default daemon will not download checkpoint except if specified on INI file
+        TNetData.NetData.MinFutureBlocksToDownloadNewSafebox := FIniFile.ReadInteger(CT_INI_SECTION_GLOBAL,CT_INI_IDENT_MINPENDINGBLOCKSTODOWNLOADCHECKPOINT,0);
         // Reading database
         FNode.InitSafeboxAndOperations(MaxBlockToRead);
         FWalletKeys.SafeBox := FNode.Node.Bank.SafeBox;

+ 7 - 1
src/pascalcoin_daemon.ini

@@ -8,6 +8,12 @@ NODE_PORT=4004
 ;NODE_MAX_CONNECTIONS : Integer (Default 100)
 ;Max node connections P2P
 NODE_MAX_CONNECTIONS=100
+;LOWMEMORY : Boolean
+;If True, will read/write directly to file storage, using less memory but decreasing speed
+LOWMEMORY=0
+;MINPENDINGBLOCKSTODOWNLOADCHECKPOINT : Integer
+;If > 200 then will allow to download checkpoint when pending blocks are greater than min value provided
+MINPENDINGBLOCKSTODOWNLOADCHECKPOINT=0
 ;RPC_PORT : Integer (Default 4003)
 ;Port to use by TCP/IP JSON-RPC commands
 RPC_PORT=4003
@@ -34,7 +40,7 @@ RPC_SERVERMINER_B58_PUBKEY=
 RPC_SERVERMINER_MAX_CONNECTIONS=1000
 ;RPC_SERVERMINER_MAX_OPERATIONS_PER_BLOCK : Integer
 ;Max operations included per block
-RPC_SERVERMINER_MAX_OPERATIONS_PER_BLOCK=5000
+RPC_SERVERMINER_MAX_OPERATIONS_PER_BLOCK=10000
 ;RPC_SERVERMINER_MAX_ZERO_FEE_OPERATIONS : Integer
 ;Max operations without fee that can be included in a block
 ;Note: Operations with fee>0 are processed first (have more priority)