Skip to content

Commit 5b94364

Browse files
yeasymastersingh24
authored andcommitted
[FAB-10240] Remove duplicated checking on TxID
When doing endorsement, the TxID is checked in core/common/validation/msgvalidation.go to make sure it equals to SHA256(nonce+creator). After that, check whether it is empty again in the core/endorser/endorser.go. However, the later checking actually won't happen because of the previous validation. This patchset removed the unused empty checking code. Change-Id: I99de8e833432200196741b55555d9006f8cb86a0 Signed-off-by: Baohua Yang <yangbaohua@gmail.com>
1 parent ea2296d commit 5b94364

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

core/endorser/endorser.go

+3-10
Original file line numberDiff line numberDiff line change
@@ -382,19 +382,12 @@ func (e *Endorser) preProcess(signedProp *pb.SignedProposal) (*validateResult, e
382382
}
383383

384384
chainID := chdr.ChannelId
385-
386-
// Check for uniqueness of prop.TxID with ledger
387-
// Notice that ValidateProposalMessage has already verified
388-
// that TxID is computed properly
389385
txid := chdr.TxId
390-
if txid == "" {
391-
err = errors.New("invalid txID. It must be different from the empty string")
392-
vr.resp = &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}
393-
return vr, err
394-
}
395386
endorserLogger.Debugf("[%s][%s] processing txid: %s", chainID, shorttxid(txid), txid)
387+
396388
if chainID != "" {
397-
// here we handle uniqueness check and ACLs for proposals targeting a chain
389+
// Here we handle uniqueness check and ACLs for proposals targeting a chain
390+
// Notice that ValidateProposalMessage has already verified that TxID is computed properly
398391
if _, err = e.s.GetTransactionByID(chainID, txid); err == nil {
399392
err = errors.Errorf("duplicate transaction found [%s]. Creator [%x]", txid, shdr.Creator)
400393
vr.resp = &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}

0 commit comments

Comments
 (0)