]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/sp.go
Use bytes.Equal() instead of bytes.Compare()==0
[nncp.git] / src / sp.go
index 1077563b33056fad9a7ef561d8c6d28e6ffa66e9..29fbf9b5f2945d70c725f888babbb4b023d2eb6f 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -1477,7 +1477,7 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                        if hasherAndOffset != nil {
                                delete(state.fileHashers, filePath)
                                if hasherAndOffset.mth.PreaddSize() == 0 {
-                                       if bytes.Compare(hasherAndOffset.mth.Sum(nil), file.Hash[:]) != 0 {
+                                       if !bytes.Equal(hasherAndOffset.mth.Sum(nil), file.Hash[:]) {
                                                state.Ctx.LogE(
                                                        "sp-file-bad-checksum", lesp,
                                                        errors.New("checksum mismatch"),