From c4588492c8990596f45d669d0a2e5785edfbeb73 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Sat, 19 Aug 2023 03:31:05 +0530 Subject: [PATCH] check hasher --- code/go/0chain.net/blobbercore/allocation/file_changer_base.go | 3 +++ code/go/0chain.net/blobbercore/writemarker/protocol.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/go/0chain.net/blobbercore/allocation/file_changer_base.go b/code/go/0chain.net/blobbercore/allocation/file_changer_base.go index c689f0739..c8e733dde 100644 --- a/code/go/0chain.net/blobbercore/allocation/file_changer_base.go +++ b/code/go/0chain.net/blobbercore/allocation/file_changer_base.go @@ -94,6 +94,9 @@ func (fc *BaseFileChanger) CommitToFileStore(ctx context.Context) error { fileInputData.FixedMerkleRoot = fc.FixedMerkleRoot fileInputData.ChunkSize = fc.ChunkSize fileInputData.Hasher = GetHasher(fc.ConnectionID, encryption.Hash(fc.Path)) + if fileInputData.Hasher == nil { + return common.NewError("invalid_parameters", "Invalid parameters. Error getting hasher for commit.") + } _, err := filestore.GetFileStore().CommitWrite(fc.AllocationID, fc.ConnectionID, fileInputData) if err != nil { return common.NewError("file_store_error", "Error committing to file store. "+err.Error()) diff --git a/code/go/0chain.net/blobbercore/writemarker/protocol.go b/code/go/0chain.net/blobbercore/writemarker/protocol.go index cfe950b40..3999b2b18 100644 --- a/code/go/0chain.net/blobbercore/writemarker/protocol.go +++ b/code/go/0chain.net/blobbercore/writemarker/protocol.go @@ -86,7 +86,7 @@ func (wme *WriteMarkerEntity) VerifyMarker(ctx context.Context, dbAllocation *al } currTime := common.Now() - // blobber clock is allowed to be 10 seconds behind the current time + // blobber clock is allowed to be 60 seconds behind the current time if wme.WM.Timestamp > currTime+60 { return common.NewError("write_marker_validation_failed", "Write Marker timestamp is in the future") }