From 0f02cdc4915aaad630e2a005b9455f4bd7b4f2c6 Mon Sep 17 00:00:00 2001 From: Calin Martinconi Date: Fri, 11 Oct 2024 14:32:31 +0300 Subject: [PATCH] fix: show rchash duration response in seconds --- openapi/SwarmCommon.yaml | 2 +- pkg/api/rchash.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openapi/SwarmCommon.yaml b/openapi/SwarmCommon.yaml index 7f309582cfe..929842764ec 100644 --- a/openapi/SwarmCommon.yaml +++ b/openapi/SwarmCommon.yaml @@ -1016,7 +1016,7 @@ components: type: object properties: duration: - type: integer + type: number hash: $ref: "#/components/schemas/SwarmAddress" proofs: diff --git a/pkg/api/rchash.go b/pkg/api/rchash.go index 3aec3e3836a..24fe803ed4c 100644 --- a/pkg/api/rchash.go +++ b/pkg/api/rchash.go @@ -7,7 +7,6 @@ import ( "encoding/hex" "net/http" "strconv" - "time" "github.com/ethereum/go-ethereum/common" "github.com/ethersphere/bee/v2/pkg/jsonhttp" @@ -19,7 +18,7 @@ import ( type RCHashResponse struct { Hash swarm.Address `json:"hash"` Proofs ChunkInclusionProofs `json:"proofs"` - Duration time.Duration `json:"duration"` + Duration float64 `json:"duration"` } type ChunkInclusionProofs struct { @@ -132,7 +131,7 @@ func (s *Service) rchash(w http.ResponseWriter, r *http.Request) { resp := RCHashResponse{ Hash: swp.Hash, - Duration: swp.Duration, + Duration: swp.Duration.Seconds(), Proofs: renderChunkInclusionProofs(swp.Proofs), }