@@ -27,6 +27,7 @@ import (
27
27
"github.com/hyperledger/fabric/core/ledger"
28
28
"github.com/hyperledger/fabric/core/ledger/kvledger"
29
29
"github.com/hyperledger/fabric/core/peer"
30
+ "github.com/hyperledger/fabric/protos/common"
30
31
pb "github.com/hyperledger/fabric/protos/peer"
31
32
putils "github.com/hyperledger/fabric/protos/utils"
32
33
)
@@ -237,7 +238,7 @@ func (e *Endorser) endorseProposal(ctx context.Context, proposal *pb.Proposal, s
237
238
238
239
// FIXME: this method might be of general interest, should we package it somewhere else?
239
240
// validateChaincodeProposalMessage checks the validity of a CHAINCODE Proposal message
240
- func (e * Endorser ) validateChaincodeProposalMessage (prop * pb.Proposal , hdr * pb .Header ) (* pb.ChaincodeHeaderExtension , error ) {
241
+ func (e * Endorser ) validateChaincodeProposalMessage (prop * pb.Proposal , hdr * common .Header ) (* pb.ChaincodeHeaderExtension , error ) {
241
242
devopsLogger .Infof ("validateChaincodeProposalMessage starts for proposal %p, header %p" , prop , hdr )
242
243
243
244
// 4) based on the header type (assuming it's CHAINCODE), look at the extensions
@@ -263,7 +264,7 @@ func (e *Endorser) validateChaincodeProposalMessage(prop *pb.Proposal, hdr *pb.H
263
264
// validateProposalMessage checks the validity of a generic Proposal message
264
265
// this function returns Header and ChaincodeHeaderExtension messages since they
265
266
// have been unmarshalled and validated
266
- func (e * Endorser ) validateProposalMessage (prop * pb.Proposal ) (* pb .Header , * pb.ChaincodeHeaderExtension , error ) {
267
+ func (e * Endorser ) validateProposalMessage (prop * pb.Proposal ) (* common .Header , * pb.ChaincodeHeaderExtension , error ) {
267
268
devopsLogger .Infof ("validateProposalMessage starts for proposal %p" , prop )
268
269
269
270
// 1) look at the ProposalHeader
@@ -273,17 +274,17 @@ func (e *Endorser) validateProposalMessage(prop *pb.Proposal) (*pb.Header, *pb.C
273
274
}
274
275
275
276
// - validate the type
276
- if hdr .Type != pb . Header_CHAINCODE {
277
- return nil , nil , fmt .Errorf ("Invalid proposal type %d" , hdr .Type )
277
+ if hdr .ChainHeader . Type != int32 ( common . HeaderType_ENDORSER_TRANSACTION ) {
278
+ return nil , nil , fmt .Errorf ("Invalid proposal type %d" , hdr .ChainHeader . Type )
278
279
}
279
280
280
- devopsLogger .Infof ("validateProposalMessage info: proposal type %d" , hdr .Type )
281
+ devopsLogger .Infof ("validateProposalMessage info: proposal type %d" , hdr .ChainHeader . Type )
281
282
282
283
// - ensure that there is a nonce and a creator
283
- if hdr .Nonce == nil || len (hdr .Nonce ) == 0 {
284
+ if hdr .SignatureHeader . Nonce == nil || len (hdr . SignatureHeader .Nonce ) == 0 {
284
285
return nil , nil , fmt .Errorf ("Invalid nonce specified in the header" )
285
286
}
286
- if hdr .Creator == nil || len (hdr .Creator ) == 0 {
287
+ if hdr .SignatureHeader . Creator == nil || len (hdr . SignatureHeader .Creator ) == 0 {
287
288
return nil , nil , fmt .Errorf ("Invalid creator specified in the header" )
288
289
}
289
290
0 commit comments