Browse Source

PIP-0029: pseudo-code fixes

Herman Schoenfeld 6 years ago
parent
commit
89a5c0184b
1 changed files with 10 additions and 10 deletions
  1. 10 10
      PIP/PIP-0029.md

+ 10 - 10
PIP/PIP-0029.md

@@ -148,22 +148,22 @@ An account history is composed of a chronological order of account events. An ac
    end;
    end;
 
 
    function IsValidAccountHistory(const AHistory : TAccountHistory) : Boolean;
    function IsValidAccountHistory(const AHistory : TAccountHistory) : Boolean;
-   var 
-     LPrevSeg : TAccountSegment;     // note: this is confusingly called TBlockAccount in implementation (should be changed, IMO)
+   var
+     LAccount : TAccount; 
      LActualPriorSafeBoxState : TBytes;
      LActualPriorSafeBoxState : TBytes;
    begin
    begin
      
      
      // validate in reverse
      // validate in reverse
-     for i := Length(History) - 1 downto 1 do begin
-       LAccount := History[i].AccountState;
-       LPriorEvent := History[i-1];
+     for i := Length(AHistory) - 1 downto 1 do begin
+       LAccount := AHistory[i].AccountState;
+       LPriorEvent := AHistory[i-1];
        if NOT FetchSafeBoxState(LPriorEvent.LastBlockNum, out LActualPriorSafeBoxState)
        if NOT FetchSafeBoxState(LPriorEvent.LastBlockNum, out LActualPriorSafeBoxState)
          exit(false);  // prior event referred to non-existent "last block num"
          exit(false);  // prior event referred to non-existent "last block num"
 
 
-       if LPriorEvent.SafeBoxRoot <> LActualPriorRoot then
+       if LPriorEvent.SafeBoxRoot <> LActualPriorSafeBoxState then
          exit(false);  // prior event referred to invalid "safebox state"
          exit(false);  // prior event referred to invalid "safebox state"
 
 
-       if LAccount.Seal <> CalculateSeal(LPriorEvent.AccountState, LPriorEvent.OPID, LPriorEvent.SafeBoxRoot) then
+       if LAccount.Seal <> CalculateSeal(LPriorEvent.AccountState, LPriorEvent.OPID, LPriorEvent.SafeBoxState ) then
           exit(false);  // prior event did not result in current account state
           exit(false);  // prior event did not result in current account state
       end;
       end;
        // account history is valid
        // account history is valid
@@ -171,12 +171,12 @@ An account history is composed of a chronological order of account events. An ac
    end
    end
 
 
    
    
-   function CalculateSeal( AccountSate : TAccount; PriorSafeBoxState: TBytes;  MutatingOPID : TBytes ) : TBytes;
+   function CalculateSeal( PriorAccountState : TAccount; PriorSafeBoxState: TBytes;  MutatingOPID : TBytes ) : TBytes;
    begin
    begin
-      return RIPEMD160 ( SHA2_256 ( Array.Join( PriorSafeBoxState, SerializeAccount ( AccountSate ), MutatingOPID  ) ) );
+      return RIPEMD160 ( SHA2_256 ( Array.Join( PriorSafeBoxState, SerializeAccount ( PriorAccountState ), MutatingOPID  ) ) );
    end
    end
 
 
-   function SerializeAccount(account : TAccount) : TBytes;
+   function SerializeAccount(Account : TAccount) : TBytes;
    begin 
    begin 
      // as per network protocol
      // as per network protocol
    end
    end