Add salt to hashlock contract

This commit is contained in:
John David Pressman 2020-01-22 01:40:23 -08:00
parent 7756bfda93
commit d878387424

View File

@ -9,6 +9,9 @@ type parameter = {
} }
let main ((p,s): parameter * storage) : operation list * storage = let main ((p,s): parameter * storage) : operation list * storage =
(* We have to use a hash salted with the solvers address, otherwise a baker
could steal *)
let salted: bytes = Bytes.concat p.hashable (Bytes.pack sender) in
if ((Crypto.sha256 p.hashable) = s.hashed) && s.unused if ((Crypto.sha256 p.hashable) = s.hashed) && s.unused
then then
let s: storage = {hashed = s.hashed; unused = false} in let s: storage = {hashed = s.hashed; unused = false} in