Browse Source

Clean code

Delete XXXXXXX comments
PascalCoin 7 years ago
parent
commit
6bd5b5645f
4 changed files with 11 additions and 31 deletions
  1. 3 12
      src/core/UAccounts.pas
  2. 4 14
      src/core/UBlockChain.pas
  3. 1 5
      src/core/UNetProtocol.pas
  4. 3 0
      src/core/USettings.pas

+ 3 - 12
src/core/UAccounts.pas

@@ -300,7 +300,7 @@ Type
     FLock: TPCCriticalSection; // Thread safe
     FLock: TPCCriticalSection; // Thread safe
     FWorkSum : UInt64;
     FWorkSum : UInt64;
     FCurrentProtocol: Integer;
     FCurrentProtocol: Integer;
-    // Snapshots utility new on V3  XXXXXXXXXXXXXX
+    // Snapshots utility new on V3
     FSnapshots : TList; // Will save a Snapshots lists in order to rollback Safebox to a previous block state
     FSnapshots : TList; // Will save a Snapshots lists in order to rollback Safebox to a previous block state
     FMaxSafeboxSnapshots : Integer;
     FMaxSafeboxSnapshots : Integer;
     // To be added to next snapshot
     // To be added to next snapshot
@@ -329,7 +329,7 @@ Type
     Constructor Create;
     Constructor Create;
     Destructor Destroy; override;
     Destructor Destroy; override;
     procedure SetToPrevious(APreviousSafeBox : TPCSafeBox; StartBlock : Cardinal);
     procedure SetToPrevious(APreviousSafeBox : TPCSafeBox; StartBlock : Cardinal);
-    procedure CommitToPrevious; // XXXXXXXXXXX New: Commit changes to Previous Safebox
+    procedure CommitToPrevious;
     procedure RollBackToSnapshot(snapshotBlock : Cardinal);
     procedure RollBackToSnapshot(snapshotBlock : Cardinal);
     function AccountsCount: Integer;
     function AccountsCount: Integer;
     Function BlocksCount : Integer;
     Function BlocksCount : Integer;
@@ -768,7 +768,7 @@ Var n, i : Cardinal;
 begin
 begin
   {$IFDEF TESTNET}
   {$IFDEF TESTNET}
   // TESTNET used (line_index +1), but PRODUCTION must use (line_index)
   // TESTNET used (line_index +1), but PRODUCTION must use (line_index)
-  n := (line_index + 1) DIV CT_NewLineRewardDecrease;  // XXXXXXXXXXXXXXX TESTNET BAD USE (line_index + 1)
+  n := (line_index + 1) DIV CT_NewLineRewardDecrease;  // TESTNET BAD USE (line_index + 1)
   {$ELSE}
   {$ELSE}
   n := line_index DIV CT_NewLineRewardDecrease; // FOR PRODUCTION
   n := line_index DIV CT_NewLineRewardDecrease; // FOR PRODUCTION
   {$ENDIF}
   {$ENDIF}
@@ -2604,11 +2604,6 @@ end;
 
 
 function TPCSafeBox.DoUpgradeToProtocol3: Boolean;
 function TPCSafeBox.DoUpgradeToProtocol3: Boolean;
 begin
 begin
-  // XXXXXXXXXXX
-  // XXXXXXXXXXX
-  // TODO IF NEEDED
-  // XXXXXXXXXXX
-  // XXXXXXXXXXX
   FCurrentProtocol := CT_PROTOCOL_3;
   FCurrentProtocol := CT_PROTOCOL_3;
   Result := True;
   Result := True;
   TLog.NewLog(ltInfo,ClassName,'End Upgraded to protocol 3 - New safeboxhash:'+TCrypto.ToHexaString(FSafeBoxHash));
   TLog.NewLog(ltInfo,ClassName,'End Upgraded to protocol 3 - New safeboxhash:'+TCrypto.ToHexaString(FSafeBoxHash));
@@ -4159,10 +4154,6 @@ begin
     end;
     end;
   end;
   end;
   // All Ok, can do changes
   // All Ok, can do changes
-  // XXXXXXXXXXXXXXXX
-  // PREVIOUS BUG !!!!
-  // On previous versions (2.1.6) this update change was made prior to check all!
-  // XXXXXXXXXXXXXXXX
   previous.UpdateIfLower(P_signer^.account,P_signer^.updated_block);
   previous.UpdateIfLower(P_signer^.account,P_signer^.updated_block);
   if P_signer^.updated_block <> Origin_BlocksCount then begin
   if P_signer^.updated_block <> Origin_BlocksCount then begin
     P_signer^.previous_updated_block := P_signer^.updated_block;
     P_signer^.previous_updated_block := P_signer^.updated_block;

+ 4 - 14
src/core/UBlockChain.pas

@@ -1402,9 +1402,10 @@ begin
       else soob := 2;}
       else soob := 2;}
       soob := 2;
       soob := 2;
       if (SaveToStorage) then begin
       if (SaveToStorage) then begin
+        {Old versions:
         // Introduced on protocol v2: soob = 4 when saving to storage
         // Introduced on protocol v2: soob = 4 when saving to storage
-        soob := 4;
-        // XXXXXXXXXXXXXXXX
+        soob := 4;}
+        // Introduced on protocol v3: soob = 5 when saving to storage
         soob := 5; // V3 will always save PreviousUpdatedBlocks
         soob := 5; // V3 will always save PreviousUpdatedBlocks
       end;
       end;
     end;
     end;
@@ -2373,10 +2374,7 @@ end;
 
 
 procedure TPCOperation.FillOperationResume(Block: Cardinal; getInfoForAllAccounts : Boolean; Affected_account_number: Cardinal; var OperationResume: TOperationResume);
 procedure TPCOperation.FillOperationResume(Block: Cardinal; getInfoForAllAccounts : Boolean; Affected_account_number: Cardinal; var OperationResume: TOperationResume);
 begin
 begin
-  // XXXXXXXXXXXXXXXX
-  // TODO
-  // change from class function TPCOperation.OperationToOperationResume(Block : Cardinal; Operation: TPCOperation; Affected_account_number: Cardinal; var OperationResume: TOperationResume): Boolean;
-  // to here
+  //
 end;
 end;
 
 
 function TPCOperation.LoadFromNettransfer(Stream: TStream): Boolean;
 function TPCOperation.LoadFromNettransfer(Stream: TStream): Boolean;
@@ -2665,16 +2663,8 @@ begin
 end;
 end;
 
 
 function TPCOperation.SaveToStorage(Stream: TStream): Boolean;
 function TPCOperation.SaveToStorage(Stream: TStream): Boolean;
-
 begin
 begin
   Result := SaveOpToStream(Stream,True);
   Result := SaveOpToStream(Stream,True);
-  { XXXXXXXXXXXXXXX
-  DEPRECATED on V3, will use TPreviousUpdatedBlocks
-  Stream.Write(FPrevious_Signer_updated_block,Sizeof(FPrevious_Signer_updated_block));
-  Stream.Write(FPrevious_Destination_updated_block,SizeOf(FPrevious_Destination_updated_block));
-  Stream.Write(FPrevious_Seller_updated_block,SizeOf(FPrevious_Seller_updated_block));
-
-  Result := true; }
 end;
 end;
 
 
 function TPCOperation.Sha256: TRawBytes;
 function TPCOperation.Sha256: TRawBytes;

+ 1 - 5
src/core/UNetProtocol.pas

@@ -1120,7 +1120,7 @@ end;
 
 
 constructor TNetData.Create(AOwner: TComponent);
 constructor TNetData.Create(AOwner: TComponent);
 begin
 begin
-  inherited Create(AOwner);  // XXXXXXXXXXXXX BUG
+  inherited Create(AOwner);
   FOnProcessReservedAreaMessage:=Nil;
   FOnProcessReservedAreaMessage:=Nil;
   TLog.NewLog(ltInfo,ClassName,'TNetData.Create');
   TLog.NewLog(ltInfo,ClassName,'TNetData.Create');
   FMaxConnections := CT_MaxClientsConnected;
   FMaxConnections := CT_MaxClientsConnected;
@@ -1571,11 +1571,7 @@ Const CT_LogSender = 'GetNewBlockChainFromClient';
       Bank.Storage.CopyConfiguration(TNode.Node.Bank.Storage);
       Bank.Storage.CopyConfiguration(TNode.Node.Bank.Storage);
       if start_block>=0 then begin
       if start_block>=0 then begin
         If (TNode.Node.Bank.SafeBox.HasSnapshotForBlock(start_block-1)) then begin
         If (TNode.Node.Bank.SafeBox.HasSnapshotForBlock(start_block-1)) then begin
-          // XXXXXXXXXXXXX
-          // XXXXXXXXXXXXX
           // Restore from a Snapshot (New on V3) instead of restore reading from File
           // Restore from a Snapshot (New on V3) instead of restore reading from File
-          // XXXXXXXXXXXXX
-          // XXXXXXXXXXXXX
           Bank.SafeBox.SetToPrevious(TNode.Node.Bank.SafeBox,start_block-1);
           Bank.SafeBox.SetToPrevious(TNode.Node.Bank.SafeBox,start_block-1);
           Bank.UpdateValuesFromSafebox;
           Bank.UpdateValuesFromSafebox;
           IsUsingSnapshot := True;
           IsUsingSnapshot := True;

+ 3 - 0
src/core/USettings.pas

@@ -43,6 +43,8 @@ const
   CT_PARAM_JSONRPCMinerServerActive = 'JSONRPCMinerServerActive';
   CT_PARAM_JSONRPCMinerServerActive = 'JSONRPCMinerServerActive';
   CT_PARAM_JSONRPCEnabled = 'JSONRPCEnabled';
   CT_PARAM_JSONRPCEnabled = 'JSONRPCEnabled';
   CT_PARAM_JSONRPCAllowedIPs = 'JSONRPCAllowedIPs';
   CT_PARAM_JSONRPCAllowedIPs = 'JSONRPCAllowedIPs';
+  CT_PARAM_HashRateAvgBlocksCount = 'HashRateAvgBlocksCount';
+  CT_PARAM_ShowHashRateAs = 'ShowHashRateAs';
 
 
 type
 type
 
 
@@ -118,6 +120,7 @@ implementation
 uses
 uses
   Classes, SysUtils, UConst, UFolderHelper;
   Classes, SysUtils, UConst, UFolderHelper;
 
 
+
 { TSettings }
 { TSettings }
 
 
 class procedure TSettings.Load;
 class procedure TSettings.Load;