MCPcopy
hub / github.com/hyperledger/fabric / MarshalOrPanic

Function MarshalOrPanic

protoutil/commonutils.go:22–31  ·  view source on GitHub ↗

MarshalOrPanic serializes a protobuf message and panics if this operation fails

(pb proto.Message)

Source from the content-addressed store, hash-verified

20// MarshalOrPanic serializes a protobuf message and panics if this
21// operation fails
22func MarshalOrPanic(pb proto.Message) []byte {
23 if !pb.ProtoReflect().IsValid() {
24 panic(errors.New("proto: Marshal called with nil"))
25 }
26 data, err := proto.Marshal(pb)
27 if err != nil {
28 panic(err)
29 }
30 return data
31}
32
33// Marshal serializes a protobuf message.
34func Marshal(pb proto.Message) ([]byte, error) {

Callers 15

createDeliverEnvelopeFunction · 0.92
createHeaderFunction · 0.92
smartbft_test.goFile · 0.92
updateBatchSizeFunction · 0.92
createPrePrepareRequestFunction · 0.92
config_test.goFile · 0.92
revokeReaderAccessFunction · 0.92
consenterAdderFunction · 0.92
consenterRemoverFunction · 0.92
configToGenesisBlockFunction · 0.92

Calls 4

IsValidMethod · 0.65
NewMethod · 0.65
MarshalMethod · 0.65
ProtoReflectMethod · 0.45

Tested by 15

createDeliverEnvelopeFunction · 0.74
createHeaderFunction · 0.74
updateBatchSizeFunction · 0.74
createPrePrepareRequestFunction · 0.74
revokeReaderAccessFunction · 0.74
consenterAdderFunction · 0.74
consenterRemoverFunction · 0.74
configToGenesisBlockFunction · 0.74
signConfigUpdateFunction · 0.74