Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,20 @@ func (c *Client) SubmitIBTP(ibtp *pb.IBTP) (*pb.SubmitIBTPResponse, error) {
} else {
res, resp, err := c.InvokeInterchain(ibtp.From, ibtp.Index, content.DstContractId, ibtp.Category(), bizData)
if err != nil {
return nil, fmt.Errorf("invoke interchain for ibtp %s to call %s: %w", ibtp.ID(), content.Func, err)
res, _, err = c.InvokeIndexUpdate(ibtp.From, ibtp.Index, ibtp.Category())
ret.Message = fmt.Sprintf("invoke interchain for ibtp to call %s: %w", content.Func, err)
ret.Status = false
if err != nil {
return nil, err
}
}

ret.Status = resp.OK
ret.Message = resp.Message

// if there is callback function, parse returned value
result = util.ToChaincodeArgs(strings.Split(string(resp.Data), ",")...)
if resp != nil {
ret.Status = resp.OK
ret.Message = resp.Message
// if there is callback function, parse returned value
result = util.ToChaincodeArgs(strings.Split(string(resp.Data), ",")...)
}
chResp = res
}

Expand Down Expand Up @@ -345,7 +351,7 @@ func (c *Client) InvokeInterchain(from string, index uint64, destAddr string, ca
}

if err != nil {
return nil, nil, err
return &res, nil, err
}

logger.Info("response", "cc status", strconv.Itoa(int(res.ChaincodeStatus)), "payload", string(res.Payload))
Expand Down