Skip to content

Commit

Permalink
FAB-2357 join failed looking up ledger
Browse files Browse the repository at this point in the history
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 <muralisr@us.ibm.com>
  • Loading branch information
Srinivasan Muralidharan committed Feb 18, 2017
1 parent 2ecb22a commit 92dd847
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions core/endorser/endorser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92dd847

Please sign in to comment.