Skip to content

Commit

Permalink
[FAB-3562] CLI displays unexpected invoke result
Browse files Browse the repository at this point in the history
This CR improves the log messages after a successful invoke. The
previous log message displayed the ESCC invoke result instead of
the chaincode invoke result, which was confusing to end users. The
previous log message now specifies that it is for the ESCC result
and adds a new log message to display the chaincode invoke result.

This CR also adds a few logging messages to the endorser code that were
helpful during my time debugging and working to understand the
endorsement logic.

Change-Id: I02cb0dfe620e7c17472b8b12467c746c27598942
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed Jun 2, 2017
1 parent 5e49366 commit ec3ada2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/chaincode/chaincode_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,10 @@ func createCCMessage(typ pb.ChaincodeMessage_Type, txid string, cMsg *pb.Chainco

// Execute executes a transaction and waits for it to complete until a timeout value.
func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, timeout time.Duration) (*pb.ChaincodeMessage, error) {
chaincodeLogger.Debugf("Entry")
defer chaincodeLogger.Debugf("Exit")
canName := cccid.GetCanonicalName()
chaincodeLogger.Debugf("chaincode canonical name: %s", canName)
chaincodeSupport.runningChaincodes.Lock()
//we expect the chaincode to be running... sanity check
chrte, ok := chaincodeSupport.chaincodeHasBeenLaunched(canName)
Expand Down
2 changes: 1 addition & 1 deletion core/endorser/endorser.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ func (e *Endorser) ProcessProposal(ctx context.Context, signedProp *pb.SignedPro
err = errors.New("Invalid txID. It must be different from the empty string.")
return &pb.ProposalResponse{Response: &pb.Response{Status: 500, Message: err.Error()}}, err
}

endorserLogger.Debugf("processing txid: %s", txid)
if chainID != "" {
// here we handle uniqueness check and ACLs for proposals targeting a chain
lgr := peer.GetLedger(chainID)
Expand Down
11 changes: 10 additions & 1 deletion peer/chaincode/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,16 @@ func chaincodeInvokeOrQuery(cmd *cobra.Command, args []string, invoke bool, cf *
}
logger.Warningf("Endorsement failure during invoke. chaincode result: %v", ca.Response)
} else {
logger.Infof("Invoke result: %v", proposalResp)
logger.Debugf("ESCC invoke result: %v", proposalResp)
pRespPayload, err := putils.GetProposalResponsePayload(proposalResp.Payload)
if err != nil {
return fmt.Errorf("Error while unmarshaling proposal response payload: %s", err)
}
ca, err := putils.GetChaincodeAction(pRespPayload.Extension)
if err != nil {
return fmt.Errorf("Error while unmarshaling chaincode action: %s", err)
}
logger.Infof("Chaincode invoke successful. result: %v", ca.Response)
}
} else {
if proposalResp == nil {
Expand Down

0 comments on commit ec3ada2

Please sign in to comment.