Browse Source

DEFINE USE_ABSTRACTMEM_BLOCKCHAIN_STORAGE

This will enable to use indexed data on Blockchain storage so will allow to quick search indexed by ophash, by block/operation and account history
unknown 3 years ago
parent
commit
306a4cbcc8
3 changed files with 18 additions and 0 deletions
  1. 4 0
      src/config.inc
  2. 7 0
      src/core/upcdaemon.pas
  3. 7 0
      src/gui-classic/UFRMWallet.pas

+ 4 - 0
src/config.inc

@@ -74,6 +74,10 @@
   // This also fixes issue #207 High memory usage on FreePascal compiler
   // This also fixes issue #207 High memory usage on FreePascal compiler
   {.$DEFINE USE_BIGBLOCKS_MEM_ON_DISK}
   {.$DEFINE USE_BIGBLOCKS_MEM_ON_DISK}
 
 
+  // This will enable to use indexed data on Blockchain storage so will allow to quick search
+  // indexed by ophash, by block/operation and account history
+  {$DEFINE USE_ABSTRACTMEM_BLOCKCHAIN_STORAGE}
+
 { ********************************************************************
 { ********************************************************************
   Don't touch more code, it will addapt based on your preferences
   Don't touch more code, it will addapt based on your preferences
   ******************************************************************** }
   ******************************************************************** }

+ 7 - 0
src/core/upcdaemon.pas

@@ -26,6 +26,9 @@ uses
   Classes, SysUtils, daemonapp,
   Classes, SysUtils, daemonapp,
   SyncObjs, UOpenSSL, UCrypto, UNode, UFileStorage, UFolderHelper, UWallet, UConst, ULog, UNetProtocol,
   SyncObjs, UOpenSSL, UCrypto, UNode, UFileStorage, UFolderHelper, UWallet, UConst, ULog, UNetProtocol,
   IniFiles, UBaseTypes,
   IniFiles, UBaseTypes,
+  {$IFDEF USE_ABSTRACTMEM_BLOCKCHAIN_STORAGE}
+  UAbstractMemBlockchainStorage,
+  {$ENDIF}
   {$IF Defined(FPC) and Defined(WINDOWS)}windows,jwawinsvc,crt,{$ENDIF}
   {$IF Defined(FPC) and Defined(WINDOWS)}windows,jwawinsvc,crt,{$ENDIF}
   UThread, URPC, UPoolMining, UAccounts, UPCDataTypes;
   UThread, URPC, UPoolMining, UAccounts, UPCDataTypes;
 
 
@@ -306,7 +309,11 @@ begin
       InitRPCServer;
       InitRPCServer;
       Try
       Try
         // Check Database
         // Check Database
+        {$IFDEF USE_ABSTRACTMEM_BLOCKCHAIN_STORAGE}
+        FNode.Bank.StorageClass := TAbstractMemBlockchainStorageSecondary;
+        {$ELSE}
         FNode.Bank.StorageClass := TFileStorage;
         FNode.Bank.StorageClass := TFileStorage;
+        {$ENDIF}
         // By default daemon will not download checkpoint except if specified on INI file
         // 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);
         TNetData.NetData.MinFutureBlocksToDownloadNewSafebox := FIniFile.ReadInteger(CT_INI_SECTION_GLOBAL,CT_INI_IDENT_MINPENDINGBLOCKSTODOWNLOADCHECKPOINT,0);
         TNetData.NetData.OnReceivedHelloMessage:=@OnNetDataReceivedHelloMessage;
         TNetData.NetData.OnReceivedHelloMessage:=@OnNetDataReceivedHelloMessage;

+ 7 - 0
src/gui-classic/UFRMWallet.pas

@@ -324,6 +324,9 @@ Uses UFolderHelper,{$IFDEF USE_GNUGETTEXT}gnugettext,{$ENDIF}
   UOpenSSL,
   UOpenSSL,
 {$ENDIF}
 {$ENDIF}
   UTime, UFileStorage,
   UTime, UFileStorage,
+  {$IFDEF USE_ABSTRACTMEM_BLOCKCHAIN_STORAGE}
+  UAbstractMemBlockchainStorage,
+  {$ENDIF}
   UThread, UOpTransaction, UFRMPascalCoinWalletConfig,
   UThread, UOpTransaction, UFRMPascalCoinWalletConfig,
   UFRMOperationsExplorer,
   UFRMOperationsExplorer,
   {$IFDEF TESTNET}
   {$IFDEF TESTNET}
@@ -449,7 +452,11 @@ begin
     FRPCServer.ValidIPs := TSettings.JsonRpcAllowedIPs;
     FRPCServer.ValidIPs := TSettings.JsonRpcAllowedIPs;
     WalletKeys.SafeBox := FNode.Bank.SafeBox;
     WalletKeys.SafeBox := FNode.Bank.SafeBox;
     // Check Database
     // Check Database
+    {$IFDEF USE_ABSTRACTMEM_BLOCKCHAIN_STORAGE}
+    FNode.Bank.StorageClass := TAbstractMemBlockchainStorageSecondary;
+    {$ELSE}
     FNode.Bank.StorageClass := TFileStorage;
     FNode.Bank.StorageClass := TFileStorage;
+    {$ENDIF}
     FNode.Bank.Storage.Initialize;
     FNode.Bank.Storage.Initialize;
     // Init Grid
     // Init Grid