lntypes: add preimage Matches method

This commit is contained in:
Joost Jager committed 2019-03-15 10:08:26 +01:00
1 parent 36cc1da8ea
commit 10a655b6b1
1 file changed
+5
+5
View File
@@ -53,3 +53,8 @@ func MakePreimageFromStr(newPreimage string) (Preimage, error) {
func (p *Preimage) Hash() Hash {
return Hash(sha256.Sum256(p[:]))
}
// Matches returns whether this preimage is the preimage of the given hash.
func (p *Preimage) Matches(h Hash) bool {
return h == p.Hash()
}