github.com/lazyledger/lazyledger-core@v0.35.0-dev.0.20210613111200-4c651f053571/privval/msgs.go (about) 1 package privval 2 3 import ( 4 "fmt" 5 6 "github.com/gogo/protobuf/proto" 7 8 privvalproto "github.com/lazyledger/lazyledger-core/proto/tendermint/privval" 9 ) 10 11 // TODO: Add ChainIDRequest 12 13 func mustWrapMsg(pb proto.Message) privvalproto.Message { 14 msg := privvalproto.Message{} 15 16 switch pb := pb.(type) { 17 case *privvalproto.Message: 18 msg = *pb 19 case *privvalproto.PubKeyRequest: 20 msg.Sum = &privvalproto.Message_PubKeyRequest{PubKeyRequest: pb} 21 case *privvalproto.PubKeyResponse: 22 msg.Sum = &privvalproto.Message_PubKeyResponse{PubKeyResponse: pb} 23 case *privvalproto.SignVoteRequest: 24 msg.Sum = &privvalproto.Message_SignVoteRequest{SignVoteRequest: pb} 25 case *privvalproto.SignedVoteResponse: 26 msg.Sum = &privvalproto.Message_SignedVoteResponse{SignedVoteResponse: pb} 27 case *privvalproto.SignedProposalResponse: 28 msg.Sum = &privvalproto.Message_SignedProposalResponse{SignedProposalResponse: pb} 29 case *privvalproto.SignProposalRequest: 30 msg.Sum = &privvalproto.Message_SignProposalRequest{SignProposalRequest: pb} 31 case *privvalproto.PingRequest: 32 msg.Sum = &privvalproto.Message_PingRequest{PingRequest: pb} 33 case *privvalproto.PingResponse: 34 msg.Sum = &privvalproto.Message_PingResponse{PingResponse: pb} 35 default: 36 panic(fmt.Errorf("unknown message type %T", pb)) 37 } 38 39 return msg 40 }