Просмотр исходного кода

New digest hash value for OP_DATA ( PIP-0016 ) on Protocol 5

PascalCoin 6 лет назад
Родитель
Сommit
f0a3951bad
2 измененных файлов с 7 добавлено и 2 удалено
  1. 1 0
      README.md
  2. 6 2
      src/core/UOpTransaction.pas

+ 1 - 0
README.md

@@ -37,6 +37,7 @@ Also, consider a donation at PascalCoin development account: "0-10"
 ### Current Build (Pending release date)
 - Upgrade to Protocol 5 (Hard fork)
 - Implementation of PIP-0030 -> https://github.com/PascalCoin/PascalCoin/blob/master/PIP/PIP-0030.md
+- New digest hash value for OP_DATA ( PIP-0016 ) on Protocol 5
 
 
 ### Build 4.0.3.1 - 2019-04-12

+ 6 - 2
src/core/UOpTransaction.pas

@@ -2452,7 +2452,7 @@ begin
 end;
 
 function TOpData.GetDigestToSign(current_protocol: Word): TRawBytes;
-var Stream : TStream;
+var Stream : TMemoryStream;
   b : Byte;
 begin
   Stream := TMemoryStream.Create;
@@ -2468,7 +2468,11 @@ begin
     TStreamOp.WriteAnsiString(Stream,FData.payload);
     b := OpType;
     Stream.Write(b,1);
-    Result := TStreamOp.SaveStreamToRaw(Stream);
+    if (current_protocol<=CT_PROTOCOL_4) then begin
+      Result := TStreamOp.SaveStreamToRaw(Stream);
+    end else begin
+      Result := TCrypto.DoSha256(Stream.Memory,Stream.Size);
+    end;
   finally
     Stream.Free;
   end;