Browse Source

Fixed Bug on accounts listed for Swap

PascalCoin 6 years ago
parent
commit
b10b198453
1 changed files with 20 additions and 2 deletions
  1. 20 2
      src/core/UAccounts.pas

+ 20 - 2
src/core/UAccounts.pas

@@ -1662,9 +1662,24 @@ begin
         Result := IsValidAccountKey(AAccountInfo.accountKey,errors);
         Result := IsValidAccountKey(AAccountInfo.accountKey,errors);
       end;
       end;
     as_ForSale: begin
     as_ForSale: begin
-        If Not IsValidAccountKey(AAccountInfo.accountKey,s) then errors := errors +' '+s;
-        Result := errors='';
+        Result := IsValidAccountKey(AAccountInfo.accountKey,errors);
+        if (Result) And (IsAccountForPrivateSale(AAccountInfo)) then begin
+          if Not IsValidAccountKey(AAccountInfo.new_publicKey,s) then begin
+            Result := False;
+            errors := 'Invalid new_publicKey: '+s;
+          end;
+        end;
       end;
       end;
+    as_ForAtomicAccountSwap: begin
+        Result := IsValidAccountKey(AAccountInfo.accountKey,errors);
+        if (Result) And (Not IsValidAccountKey(AAccountInfo.new_publicKey,s)) then begin
+          Result := False;
+          errors := 'Invalid AccountSwap.new_publicKey: '+s;
+        end;
+      end;
+    as_ForAtomicCoinSwap: begin
+      Result := IsValidAccountKey(AAccountInfo.accountKey,errors);
+    end
   else
   else
     raise Exception.Create('DEVELOP ERROR 20170214-3');
     raise Exception.Create('DEVELOP ERROR 20170214-3');
   end;
   end;
@@ -1874,6 +1889,7 @@ Type
     price : UInt64;
     price : UInt64;
     account_to_pay : Cardinal;
     account_to_pay : Cardinal;
     new_publicKeyKS : PAccountKey;
     new_publicKeyKS : PAccountKey;
+    hashed_secret: TRawBytes;
   end;
   end;
   {$ENDIF}
   {$ENDIF}
 
 
@@ -1947,6 +1963,7 @@ begin
   dest.accountInfoKS.price:=source.accountInfo.price;
   dest.accountInfoKS.price:=source.accountInfo.price;
   dest.accountInfoKS.account_to_pay:=source.accountInfo.account_to_pay;
   dest.accountInfoKS.account_to_pay:=source.accountInfo.account_to_pay;
   dest.accountInfoKS.new_publicKeyKS:=TAccountKeyStorage.KS.AddAccountKey(source.accountInfo.new_publicKey);
   dest.accountInfoKS.new_publicKeyKS:=TAccountKeyStorage.KS.AddAccountKey(source.accountInfo.new_publicKey);
+  dest.accountInfoKS.hashed_secret:=source.accountInfo.hashed_secret;
   {$ELSE}
   {$ELSE}
   TAccountComp.AccountInfo2RawString(source.accountInfo,raw);
   TAccountComp.AccountInfo2RawString(source.accountInfo,raw);
   TBaseType.To256RawBytes(raw,dest.accountInfo);
   TBaseType.To256RawBytes(raw,dest.accountInfo);
@@ -1978,6 +1995,7 @@ begin
   dest.accountInfo.price:=source.accountInfoKS.price;
   dest.accountInfo.price:=source.accountInfoKS.price;
   dest.accountInfo.account_to_pay:=source.accountInfoKS.account_to_pay;
   dest.accountInfo.account_to_pay:=source.accountInfoKS.account_to_pay;
   dest.accountInfo.new_publicKey:=source.accountInfoKS.new_publicKeyKS^;
   dest.accountInfo.new_publicKey:=source.accountInfoKS.new_publicKeyKS^;
+  dest.accountInfo.hashed_secret:=source.accountInfoKS.hashed_secret;
   {$ELSE}
   {$ELSE}
   TBaseType.ToRawBytes(source.accountInfo,raw);
   TBaseType.ToRawBytes(source.accountInfo,raw);
   TAccountComp.RawString2AccountInfo(raw,dest.accountInfo);
   TAccountComp.RawString2AccountInfo(raw,dest.accountInfo);