From 63ee6b6791b6cb4ebd79ad7c916ea4fe9fdb2f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 4 Feb 2020 07:55:57 +0100 Subject: [PATCH] remote: Fix put in commit --- cli/chain.go | 2 +- node/impl/storminer.go | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cli/chain.go b/cli/chain.go index 8fe34ad16..6f691edee 100644 --- a/cli/chain.go +++ b/cli/chain.go @@ -455,7 +455,7 @@ var chainBisectCmd = &cli.Command{ for { mid := (start + end) / 2 - if end - start == 1 { + if end-start == 1 { mid = end start = end } diff --git a/node/impl/storminer.go b/node/impl/storminer.go index 7a60119c5..4c54a4074 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -108,11 +108,21 @@ func (sm *StorageMinerAPI) remotePutSector(w http.ResponseWriter, r *http.Reques } // This is going to get better with worker-to-worker transfers - path, err := sm.SectorBuilder.AllocSectorPath(fs.DataType(vars["type"]), id, true) + + path, err := sm.SectorBuilder.SectorPath(fs.DataType(vars["type"]), id) if err != nil { - log.Error(err) - w.WriteHeader(500) - return + if err != fs.ErrNotFound { + log.Error(err) + w.WriteHeader(500) + return + } + + path, err = sm.SectorBuilder.AllocSectorPath(fs.DataType(vars["type"]), id, true) + if err != nil { + log.Error(err) + w.WriteHeader(500) + return + } } mediatype, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))