From 3394a55db4be25eba194c65620f4c991c3063e8e Mon Sep 17 00:00:00 2001 From: Artem Date: Mon, 10 Jul 2023 12:19:41 +0100 Subject: [PATCH] Fix: opg response --- cmd/api/handlers/responses.go | 6 +++++- internal/models/operation/data.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/api/handlers/responses.go b/cmd/api/handlers/responses.go index d5d28368f..f1bb234c2 100644 --- a/cmd/api/handlers/responses.go +++ b/cmd/api/handlers/responses.go @@ -611,6 +611,10 @@ type OPGResponse struct { // NewOPGResponse - func NewOPGResponse(opg operation.OPG) OPGResponse { + var hash string + if len(opg.Hash) > 0 { + hash = encoding.MustEncodeOperationHash(opg.Hash) + } return OPGResponse{ LastID: opg.LastID, ContentIndex: opg.ContentIndex, @@ -619,7 +623,7 @@ func NewOPGResponse(opg operation.OPG) OPGResponse { TotalCost: opg.TotalCost, Flow: opg.Flow, Internals: opg.Internals, - Hash: opg.Hash, + Hash: hash, Entrypoint: opg.Entrypoint, Timestamp: opg.Timestamp, Status: opg.Status.String(), diff --git a/internal/models/operation/data.go b/internal/models/operation/data.go index 5c4bb5102..147fd4225 100644 --- a/internal/models/operation/data.go +++ b/internal/models/operation/data.go @@ -22,7 +22,7 @@ type OPG struct { TotalCost int64 Flow int64 Internals int - Hash string + Hash []byte Entrypoint string Timestamp time.Time Status types.OperationStatus