Skip to content

Commit

Permalink
Merge pull request #781 from The-K-R-O-K/illia-malachyn/763-refactor-…
Browse files Browse the repository at this point in the history
…code-duplication

refactor subscribe func and stream mock object
  • Loading branch information
franklywatson authored Nov 4, 2024
2 parents e84608b + e2f4c9d commit cfbd2f5
Show file tree
Hide file tree
Showing 4 changed files with 264 additions and 537 deletions.
8 changes: 6 additions & 2 deletions access/grpc/convert/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,16 @@ func QuorumCertificateToMessage(qc flow.QuorumCertificate) (*entities.QuorumCert
}, 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 cfbd2f5

Please sign in to comment.