Skip to content

Commit

Permalink
refactor subscribe func and stream mock object
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-malachyn committed Oct 17, 2024
1 parent 7eb6328 commit 6b6ef84
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 536 deletions.
8 changes: 6 additions & 2 deletions access/grpc/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,16 @@ func MessageToBlockHeader(m *entities.BlockHeader) (flow.BlockHeader, error) {
}, nil
}

func MessageToBlockDigest(m *access.SubscribeBlockDigestsResponse) flow.BlockDigest {
func MessageToBlockDigest(m *access.SubscribeBlockDigestsResponse) (flow.BlockDigest, error) {
if m == nil {
return flow.BlockDigest{}, ErrEmptyMessage
}

return flow.BlockDigest{
BlockID: flow.BytesToID(m.GetBlockId()),
Height: m.GetBlockHeight(),
Timestamp: m.GetBlockTimestamp().AsTime(),
}
}, nil
}

func BlockDigestToMessage(blockDigest flow.BlockDigest) *access.SubscribeBlockDigestsResponse {
Expand Down
Loading

0 comments on commit 6b6ef84

Please sign in to comment.