GetSignedProposal returns a signed proposal given a Proposal message and a signing identity
(prop *peer.Proposal, signer Signer)
| 355 | // GetSignedProposal returns a signed proposal given a Proposal message and a |
| 356 | // signing identity |
| 357 | func GetSignedProposal(prop *peer.Proposal, signer Signer) (*peer.SignedProposal, error) { |
| 358 | // check for nil argument |
| 359 | if prop == nil || signer == nil { |
| 360 | return nil, errors.New("nil arguments") |
| 361 | } |
| 362 | |
| 363 | propBytes, err := proto.Marshal(prop) |
| 364 | if err != nil { |
| 365 | return nil, err |
| 366 | } |
| 367 | |
| 368 | signature, err := signer.Sign(propBytes) |
| 369 | if err != nil { |
| 370 | return nil, err |
| 371 | } |
| 372 | |
| 373 | return &peer.SignedProposal{ProposalBytes: propBytes, Signature: signature}, nil |
| 374 | } |
| 375 | |
| 376 | // MockSignedEndorserProposalOrPanic creates a SignedProposal with the |
| 377 | // passed arguments |