From 98d6580eb847cd2df135e3d32a6de37bacbaa57c Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Tue, 13 Jun 2023 11:32:01 +0300 Subject: [PATCH] [#266] services/tree: Return operation log up to some height Signed-off-by: Dmitrii Stepanov --- pkg/services/tree/service.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/services/tree/service.go b/pkg/services/tree/service.go index 96e547f36..4364095e2 100644 --- a/pkg/services/tree/service.go +++ b/pkg/services/tree/service.go @@ -532,9 +532,13 @@ func (s *Service) GetOpLog(req *GetOpLogRequest, srv TreeService_GetOpLogServer) } h := b.GetHeight() + lastHeight, err := s.forest.TreeHeight(srv.Context(), cid, b.GetTreeId()) + if err != nil { + return err + } for { lm, err := s.forest.TreeGetOpLog(srv.Context(), cid, b.GetTreeId(), h) - if err != nil || lm.Time == 0 { + if err != nil || lm.Time == 0 || lastHeight < lm.Time { return err }