Commit e47c0e55 authored by harrylee's avatar harrylee

fix a bug for exec

parent 94ec47d9
...@@ -319,7 +319,7 @@ func (client *JSONClient) InitBroker(bxhId, appChainId, privateKey string) (*Res ...@@ -319,7 +319,7 @@ func (client *JSONClient) InitBroker(bxhId, appChainId, privateKey string) (*Res
// 发布跨链事件 // 发布跨链事件
func (client *JSONClient) EmitDataSwapInterchainEvent(dstServiceID, args, argscb, argsrb string, privateKey string) (*Response, error) { func (client *JSONClient) EmitDataSwapInterchainEvent(dstServiceID, args, argscb, argsrb string, privateKey string) (*Response, error) {
// FIXME 这里需完善 funcName="interchainGet,interchainSet," txType=0 表示是存在类数据交换 // FIXME 这里需完善 funcName="interchainGet,interchainSet," txType=0 表示是存在类数据交换
tx := broker.EmitInterchainEvent("", dstServiceID, "interchainGet,interchainSet,", args, argsrb, argsrb, 0) tx := broker.EmitInterchainEvent("", dstServiceID, "interchainGet,interchainSet,", args, argscb, argsrb, 0)
return client.SendTransactionSync(privateKey, tx) return client.SendTransactionSync(privateKey, tx)
} }
...@@ -338,16 +338,14 @@ func (client *JSONClient) Execute(requst *Request, privateKey string) (*Response ...@@ -338,16 +338,14 @@ func (client *JSONClient) Execute(requst *Request, privateKey string) (*Response
if err != nil { if err != nil {
return nil, fmt.Errorf("cannot parse %s to uint64", string(requst.Args[3])) return nil, fmt.Errorf("cannot parse %s to uint64", string(requst.Args[3]))
} }
// reqType==0 表示查询请求,需要更新inner index
// reqType==0 表示跨入交易, reqType==1 表示跨出交易,响应更新 if reqType == 0 {
if reqType != 0 {
tx := broker.UpdateIndex("", srcChainServiceID, targetCID, sequenceNum, reqType, 0) tx := broker.UpdateIndex("", srcChainServiceID, targetCID, sequenceNum, reqType, 0)
resp, err := client.SendTransactionSync(privateKey, tx) resp, err := client.SendTransactionSync(privateKey, tx)
if err != nil { if err != nil {
return resp, err return resp, err
} }
} }
//splitedCID[1]就是合约名称 //splitedCID[1]就是合约名称
splitedCID := strings.Split(targetCID, "&") splitedCID := strings.Split(targetCID, "&")
if len(splitedCID) != 2 { if len(splitedCID) != 2 {
...@@ -358,7 +356,6 @@ func (client *JSONClient) Execute(requst *Request, privateKey string) (*Response ...@@ -358,7 +356,6 @@ func (client *JSONClient) Execute(requst *Request, privateKey string) (*Response
if err := json.Unmarshal(requst.Args[4], callFunc); err != nil { if err := json.Unmarshal(requst.Args[4], callFunc); err != nil {
return nil, fmt.Errorf("unmarshal call func failed for %s", requst.Args[4]) return nil, fmt.Errorf("unmarshal call func failed for %s", requst.Args[4])
} }
fmt.Println("==================callfunc=======",callFunc.Func)
// 调用相应链码, (链码名称,参数,通道名称) // 调用相应链码, (链码名称,参数,通道名称)
if splitedCID[1] == storage.StorageX || splitedCID[1] == broker.BrokerX { if splitedCID[1] == storage.StorageX || splitedCID[1] == broker.BrokerX {
//interchainGet方法是在sdk封装的,用于支持跨链之前数据的查询 //interchainGet方法是在sdk封装的,用于支持跨链之前数据的查询
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment