From 92dd8471ec13b99278154fbd253c2402a3205b56 Mon Sep 17 00:00:00 2001 From: Srinivasan Muralidharan Date: Sat, 18 Feb 2017 14:46:04 -0500 Subject: [PATCH] FAB-2357 join failed looking up ledger https://jira.hyperledger.org/browse/FAB-2357 Not all proposals are on channels (and have a ledger). Some proposals such as to the CSCC for join is "channelless". In this instance, the failure is due to attempting to access the ledger for doing TX uniqueness checks. Given there's no ledger, we have to bypass ledger based uniqueness checks. Change-Id: I3dbdf49307989575494efc15f3586bd4a85c41cb Signed-off-by: Srinivasan Muralidharan --- core/endorser/endorser.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/endorser/endorser.go b/core/endorser/endorser.go index 2e04024b350..6da9f9f31f9 100644 --- a/core/endorser/endorser.go +++ b/core/endorser/endorser.go @@ -296,12 +296,16 @@ func (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedPro return &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}, err } - lgr := peer.GetLedger(chainID) - if lgr == nil { - return nil, errors.New("Failure while looking up the ledger") - } - if _, err := lgr.GetTransactionByID(txid); err == nil { - return nil, fmt.Errorf("Duplicate transaction found [%s]. Creator [%x]. [%s]", txid, hdr.SignatureHeader.Creator, err) + //chainless proposals do not/cannot affect ledger and cannot be submitted as transactions + //ignore uniqueness checks + if !ischainless { + lgr := peer.GetLedger(chainID) + if lgr == nil { + return nil, errors.New(fmt.Sprintf("Failure while looking up the ledger %s", chainID)) + } + if _, err := lgr.GetTransactionByID(txid); err == nil { + return nil, fmt.Errorf("Duplicate transaction found [%s]. Creator [%x]. [%s]", txid, hdr.SignatureHeader.Creator, err) + } } // obtaining once the tx simulator for this proposal. This will be nil