]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/check.go
Use bytes.Equal() instead of bytes.Compare()==0
[nncp.git] / src / check.go
index bd191034fe5191c5bf5136eabf377713792d7206..a4e0d06d31ea7cc51048acb4ec8b0d7a5a0dbd9f 100644 (file)
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2022 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ func Check(
        ); err != nil {
                return false, err
        }
-       return bytes.Compare(hsh.Sum(nil), checksum) == 0, nil
+       return bytes.Equal(hsh.Sum(nil), checksum), nil
 }
 
 func (ctx *Ctx) checkXxIsBad(nodeId *NodeId, xx TRxTx) bool {
@@ -113,7 +113,7 @@ func (ctx *Ctx) CheckNoCK(nodeId *NodeId, hshValue *[MTHSize]byte, mth MTH) (int
                ); err != nil {
                        return 0, err
                }
-               if bytes.Compare(mth.Sum(nil), hshValue[:]) == 0 {
+               if bytes.Equal(mth.Sum(nil), hshValue[:]) {
                        gut = true
                }
        }