]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/sp.go
Use bytes.Equal() instead of bytes.Compare()==0
[nncp.git] / src / sp.go
index eca9544945b1e0d734d6b21d692cce85dc68f372..29fbf9b5f2945d70c725f888babbb4b023d2eb6f 100644 (file)
--- a/src/sp.go
+++ b/src/sp.go
@@ -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
@@ -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"),