Skip to content

Commit

Permalink
[FAB-10240] Remove duplicated checking on TxID
Browse files Browse the repository at this point in the history
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>
yeasy authored and mastersingh24 committed May 21, 2018
1 parent ea2296d commit 5b94364
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions core/endorser/endorser.go
Original file line number Diff line number Diff line change
@@ -382,19 +382,12 @@ func (e *Endorser) preProcess(signedProp *pb.SignedProposal) (*validateResult, e
}

chainID := chdr.ChannelId

// Check for uniqueness of prop.TxID with ledger
// Notice that ValidateProposalMessage has already verified
// that TxID is computed properly
txid := chdr.TxId
if txid == "" {
err = errors.New("invalid txID. It must be different from the empty string")
vr.resp = &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}
return vr, err
}
endorserLogger.Debugf("[%s][%s] processing txid: %s", chainID, shorttxid(txid), txid)

if chainID != "" {
// here we handle uniqueness check and ACLs for proposals targeting a chain
// Here we handle uniqueness check and ACLs for proposals targeting a chain
// Notice that ValidateProposalMessage has already verified that TxID is computed properly
if _, err = e.s.GetTransactionByID(chainID, txid); err == nil {
err = errors.Errorf("duplicate transaction found [%s]. Creator [%x]", txid, shdr.Creator)
vr.resp = &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}

0 comments on commit 5b94364

Please sign in to comment.