1+ //nolint:dupl,unparam
12package main
23
34import (
45 "encoding/binary"
56 "encoding/json"
67 "fmt"
7- "github.com/meshplus/bitxhub-core/agency"
88 "os"
99 "strconv"
1010 "strings"
1111 "time"
1212
13+ "github.com/meshplus/bitxhub-core/agency"
14+
1315 "github.com/Rican7/retry"
1416 "github.com/Rican7/retry/strategy"
1517 "github.com/golang/protobuf/proto"
@@ -129,10 +131,7 @@ func (c *Client) Initialize(configPath string, extra []byte, mode string) error
129131 // m = make(map[string]*pb.Interchain)
130132 // }
131133
132- mgh , err := newFabricHandler (contractmeta .EventFilter , eventC )
133- if err != nil {
134- return err
135- }
134+ mgh := newFabricHandler (contractmeta .EventFilter , eventC )
136135
137136 done := make (chan bool )
138137 csm , err := NewConsumer (configPath , contractmeta , mgh , done )
@@ -316,6 +315,7 @@ func (c *Client) getProof(response channel.Response) ([]byte, error) {
316315 return nil
317316 }, strategy .Wait (2 * time .Second )); err != nil {
318317 logger .Error ("Can't get proof" , "error" , err .Error ())
318+ return nil , err
319319 }
320320
321321 return proof , nil
@@ -400,6 +400,9 @@ func (c *Client) SubmitIBTP(from string, index uint64, serviceID string, ibtpTyp
400400 destFullID := c .bitxhubID + ":" + c .appchainID + ":" + serviceID
401401 servicePair := from + "-" + destFullID
402402 ibtp , err := c .GetReceiptMessage (servicePair , index )
403+ if err != nil {
404+ return nil , err
405+ }
403406 ret .Result = ibtp
404407
405408 return ret , nil
@@ -891,11 +894,11 @@ type handler struct {
891894 ID string
892895}
893896
894- func newFabricHandler (eventFilter string , eventC chan * pb.IBTP ) ( * handler , error ) {
897+ func newFabricHandler (eventFilter string , eventC chan * pb.IBTP ) * handler {
895898 return & handler {
896899 eventC : eventC ,
897900 eventFilter : eventFilter ,
898- }, nil
901+ }
899902}
900903
901904func (h * handler ) HandleMessage (deliveries * fab.CCEvent , payload []byte ) {
@@ -910,14 +913,14 @@ func (h *handler) HandleMessage(deliveries *fab.CCEvent, payload []byte) {
910913 }
911914}
912915
913- func parseChainServiceID (id string ) (string , string , string , error ) {
914- splits := strings .Split (id , ":" )
915- if len (splits ) != 3 {
916- return "" , "" , "" , fmt .Errorf ("invalid chain service ID: %s" , id )
917- }
916+ // func parseChainServiceID(id string) (string, string, string, error) {
917+ // splits := strings.Split(id, ":")
918+ // if len(splits) != 3 {
919+ // return "", "", "", fmt.Errorf("invalid chain service ID: %s", id)
920+ // }
918921
919- return splits [0 ], splits [1 ], splits [2 ], nil
920- }
922+ // return splits[0], splits[1], splits[2], nil
923+ // }
921924
922925func parseServicePair (servicePair string ) (string , string , error ) {
923926 splits := strings .Split (servicePair , "-" )
@@ -928,9 +931,9 @@ func parseServicePair(servicePair string) (string, string, error) {
928931 return splits [0 ], splits [1 ], nil
929932}
930933
931- func genServicePair (from , to string ) string {
932- return fmt .Sprintf ("%s-%s" , from , to )
933- }
934+ // func genServicePair(from, to string) string {
935+ // return fmt.Sprintf("%s-%s", from, to)
936+ // }
934937
935938func (c * Client ) GetOffChainData (request * pb.GetDataRequest ) (* pb.OffChainDataInfo , error ) {
936939 //TODO implement me
0 commit comments