MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / SignedHeaderFromProto

Function SignedHeaderFromProto

types/light.go:197–221  ·  view source on GitHub ↗

FromProto sets a protobuf SignedHeader to the given pointer. It returns an error if the header or the commit is invalid.

(shp *tmproto.SignedHeader)

Source from the content-addressed store, hash-verified

195// FromProto sets a protobuf SignedHeader to the given pointer.
196// It returns an error if the header or the commit is invalid.
197func SignedHeaderFromProto(shp *tmproto.SignedHeader) (*SignedHeader, error) {
198 if shp == nil {
199 return nil, errors.New("nil SignedHeader")
200 }
201
202 sh := new(SignedHeader)
203
204 if shp.Header != nil {
205 h, err := HeaderFromProto(shp.Header)
206 if err != nil {
207 return nil, err
208 }
209 sh.Header = &h
210 }
211
212 if shp.Commit != nil {
213 c, err := CommitFromProto(shp.Commit)
214 if err != nil {
215 return nil, err
216 }
217 sh.Commit = c
218 }
219
220 return sh, nil
221}

Callers 2

LightBlockFromProtoFunction · 0.85
TestSignedHeaderProtoBufFunction · 0.85

Calls 2

HeaderFromProtoFunction · 0.85
CommitFromProtoFunction · 0.85

Tested by 1

TestSignedHeaderProtoBufFunction · 0.68