@@ -78,7 +78,7 @@ func ValidateProposalMessage(signedProp *pb.SignedProposal) (*pb.Proposal, *comm
78
78
}
79
79
80
80
// validate the signature
81
- err = checkSignatureFromCreator (hdr .SignatureHeader .Creator , signedProp .Signature , signedProp .ProposalBytes , hdr .ChainHeader .ChannelId )
81
+ err = checkSignatureFromCreator (hdr .SignatureHeader .Creator , signedProp .Signature , signedProp .ProposalBytes , hdr .ChannelHeader .ChannelId )
82
82
if err != nil {
83
83
return nil , nil , nil , err
84
84
}
@@ -88,7 +88,7 @@ func ValidateProposalMessage(signedProp *pb.SignedProposal) (*pb.Proposal, *comm
88
88
// TODO: perform a check against replay attacks
89
89
90
90
// continue the validation in a way that depends on the type specified in the header
91
- switch common .HeaderType (hdr .ChainHeader .Type ) {
91
+ switch common .HeaderType (hdr .ChannelHeader .Type ) {
92
92
case common .HeaderType_CONFIGURATION_TRANSACTION :
93
93
//which the types are different the validation is the same
94
94
//viz, validate a proposal to a chaincode. If we need other
@@ -105,7 +105,7 @@ func ValidateProposalMessage(signedProp *pb.SignedProposal) (*pb.Proposal, *comm
105
105
return prop , hdr , chaincodeHdrExt , err
106
106
default :
107
107
//NOTE : we proably need a case
108
- return nil , nil , nil , fmt .Errorf ("Unsupported proposal type %d" , common .HeaderType (hdr .ChainHeader .Type ))
108
+ return nil , nil , nil , fmt .Errorf ("Unsupported proposal type %d" , common .HeaderType (hdr .ChannelHeader .Type ))
109
109
}
110
110
}
111
111
@@ -172,11 +172,11 @@ func validateSignatureHeader(sHdr *common.SignatureHeader) error {
172
172
return nil
173
173
}
174
174
175
- // checks for a valid ChainHeader
176
- func validateChainHeader (cHdr * common.ChainHeader ) error {
175
+ // checks for a valid ChannelHeader
176
+ func validateChannelHeader (cHdr * common.ChannelHeader ) error {
177
177
// check for nil argument
178
178
if cHdr == nil {
179
- return fmt .Errorf ("Nil ChainHeader provided" )
179
+ return fmt .Errorf ("Nil ChannelHeader provided" )
180
180
}
181
181
182
182
// validate the header type
@@ -186,7 +186,7 @@ func validateChainHeader(cHdr *common.ChainHeader) error {
186
186
return fmt .Errorf ("invalid header type %s" , common .HeaderType (cHdr .Type ))
187
187
}
188
188
189
- putilsLogger .Infof ("validateChainHeader info: header type %d" , common .HeaderType (cHdr .Type ))
189
+ putilsLogger .Infof ("validateChannelHeader info: header type %d" , common .HeaderType (cHdr .Type ))
190
190
191
191
// TODO: validate chainID in cHdr.ChainID
192
192
@@ -203,7 +203,7 @@ func validateCommonHeader(hdr *common.Header) error {
203
203
return fmt .Errorf ("Nil header" )
204
204
}
205
205
206
- err := validateChainHeader (hdr .ChainHeader )
206
+ err := validateChannelHeader (hdr .ChannelHeader )
207
207
if err != nil {
208
208
return err
209
209
}
@@ -296,8 +296,8 @@ func validateEndorserTransaction(data []byte, hdr *common.Header) error {
296
296
}
297
297
298
298
// build the original header by stitching together
299
- // the common ChainHeader and the per-action SignatureHeader
300
- hdrOrig := & common.Header {ChainHeader : hdr .ChainHeader , SignatureHeader : sHdr }
299
+ // the common ChannelHeader and the per-action SignatureHeader
300
+ hdrOrig := & common.Header {ChannelHeader : hdr .ChannelHeader , SignatureHeader : sHdr }
301
301
hdrBytes , err := utils .GetBytesHeader (hdrOrig ) // FIXME: here we hope that hdrBytes will be the same one that the endorser had
302
302
if err != nil {
303
303
return err
@@ -342,7 +342,7 @@ func ValidateTransaction(e *common.Envelope) (*common.Payload, error) {
342
342
}
343
343
344
344
// validate the signature in the envelope
345
- err = checkSignatureFromCreator (payload .Header .SignatureHeader .Creator , e .Signature , e .Payload , payload .Header .ChainHeader .ChannelId )
345
+ err = checkSignatureFromCreator (payload .Header .SignatureHeader .Creator , e .Signature , e .Payload , payload .Header .ChannelHeader .ChannelId )
346
346
if err != nil {
347
347
return nil , err
348
348
}
@@ -352,7 +352,7 @@ func ValidateTransaction(e *common.Envelope) (*common.Payload, error) {
352
352
// TODO: perform a check against replay attacks
353
353
354
354
// continue the validation in a way that depends on the type specified in the header
355
- switch common .HeaderType (payload .Header .ChainHeader .Type ) {
355
+ switch common .HeaderType (payload .Header .ChannelHeader .Type ) {
356
356
case common .HeaderType_ENDORSER_TRANSACTION :
357
357
err = validateEndorserTransaction (payload .Data , payload .Header )
358
358
putilsLogger .Infof ("ValidateTransactionEnvelope returns err %s" , err )
@@ -362,6 +362,6 @@ func ValidateTransaction(e *common.Envelope) (*common.Payload, error) {
362
362
putilsLogger .Infof ("ValidateTransactionEnvelope returns err %s" , err )
363
363
return payload , err
364
364
default :
365
- return nil , fmt .Errorf ("Unsupported transaction payload type %d" , common .HeaderType (payload .Header .ChainHeader .Type ))
365
+ return nil , fmt .Errorf ("Unsupported transaction payload type %d" , common .HeaderType (payload .Header .ChannelHeader .Type ))
366
366
}
367
367
}
0 commit comments