Commit 253080ef authored by suyanlong's avatar suyanlong

🐛 Fixed get IBTP function

parent b0d3bccb
Pipeline #8181 canceled with stages
......@@ -9,10 +9,10 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
rpcx "gitlab.33.cn/link33/sidecar/hub/client"
pb "gitlab.33.cn/link33/sidecar/model/pb"
crypto "github.com/meshplus/bitxhub-kit/crypto"
types "github.com/meshplus/bitxhub-kit/types"
rpcx "gitlab.33.cn/link33/sidecar/hub/client"
pb "gitlab.33.cn/link33/sidecar/model/pb"
)
// MockClient is a mock of Client interface.
......
......@@ -97,7 +97,7 @@ func (a *appChain) ExecuteIBTP(ibtp *pb.IBTP) (*pb.IBTP, error) {
}).Info("Apply tx")
switch ibtp.Type {
case pb.IBTP_INTERCHAIN:
case pb.IBTP_INTERCHAIN, pb.IBTP_ROLLBACK:
return a.applyInterchainIBTP(ibtp)
case pb.IBTP_RECEIPT_SUCCESS, pb.IBTP_RECEIPT_FAILURE:
err := a.applyReceiptIBTP(ibtp)
......
......@@ -8,9 +8,9 @@ import (
reflect "reflect"
gomock "github.com/golang/mock/gomock"
appchain_mgr "github.com/meshplus/bitxhub-core/appchain-mgr"
syncer "gitlab.33.cn/link33/sidecar/internal/syncer"
pb "gitlab.33.cn/link33/sidecar/model/pb"
appchain_mgr "github.com/meshplus/bitxhub-core/appchain-mgr"
)
// MockSyncer is a mock of Syncer interface.
......
......@@ -33,9 +33,9 @@ func (m *IBTP) Hash() *types.Hash {
func (m *IBTP) Category() IBTP_Category {
switch m.Type {
case IBTP_INTERCHAIN, IBTP_ASSET_EXCHANGE_INIT, IBTP_ASSET_EXCHANGE_REDEEM, IBTP_ASSET_EXCHANGE_REFUND:
case IBTP_INTERCHAIN, IBTP_ROLLBACK:
return IBTP_REQUEST
case IBTP_RECEIPT_SUCCESS, IBTP_RECEIPT_FAILURE, IBTP_ASSET_EXCHANGE_RECEIPT:
case IBTP_RECEIPT_SUCCESS, IBTP_RECEIPT_FAILURE, IBTP_RECEIPT_ROLLBACK:
return IBTP_RESPONSE
}
return IBTP_UNKNOWN
......
......@@ -28,33 +28,27 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type IBTP_Type int32
const (
IBTP_INTERCHAIN IBTP_Type = 0
IBTP_RECEIPT_SUCCESS IBTP_Type = 1
IBTP_RECEIPT_FAILURE IBTP_Type = 2
IBTP_ASSET_EXCHANGE_INIT IBTP_Type = 3
IBTP_ASSET_EXCHANGE_REDEEM IBTP_Type = 4
IBTP_ASSET_EXCHANGE_REFUND IBTP_Type = 5
IBTP_ASSET_EXCHANGE_RECEIPT IBTP_Type = 6
IBTP_INTERCHAIN IBTP_Type = 0
IBTP_RECEIPT_SUCCESS IBTP_Type = 1
IBTP_RECEIPT_FAILURE IBTP_Type = 2
IBTP_ROLLBACK IBTP_Type = 3
IBTP_RECEIPT_ROLLBACK IBTP_Type = 4
)
var IBTP_Type_name = map[int32]string{
0: "INTERCHAIN",
1: "RECEIPT_SUCCESS",
2: "RECEIPT_FAILURE",
3: "ASSET_EXCHANGE_INIT",
4: "ASSET_EXCHANGE_REDEEM",
5: "ASSET_EXCHANGE_REFUND",
6: "ASSET_EXCHANGE_RECEIPT",
3: "ROLLBACK",
4: "RECEIPT_ROLLBACK",
}
var IBTP_Type_value = map[string]int32{
"INTERCHAIN": 0,
"RECEIPT_SUCCESS": 1,
"RECEIPT_FAILURE": 2,
"ASSET_EXCHANGE_INIT": 3,
"ASSET_EXCHANGE_REDEEM": 4,
"ASSET_EXCHANGE_REFUND": 5,
"ASSET_EXCHANGE_RECEIPT": 6,
"INTERCHAIN": 0,
"RECEIPT_SUCCESS": 1,
"RECEIPT_FAILURE": 2,
"ROLLBACK": 3,
"RECEIPT_ROLLBACK": 4,
}
func (x IBTP_Type) String() string {
......@@ -460,44 +454,42 @@ func init() {
func init() { proto.RegisterFile("ibtp.proto", fileDescriptor_7576a0a5bf0190a3) }
var fileDescriptor_7576a0a5bf0190a3 = []byte{
// 587 bytes of a gzip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xeb, 0x1b, 0x1b, 0x7d, 0xbf, 0xb1, 0xd1, 0xe7, 0x5b, 0xbb,
0x71, 0x7d, 0x6b, 0x37, 0xbe, 0xdd, 0xda, 0x8d, 0xa4, 0xa3, 0x5f, 0xda, 0xf3, 0x5f, 0x01, 0x00,
0x00, 0xff, 0xff, 0x98, 0x2d, 0x3a, 0x6f, 0x88, 0x03, 0x00, 0x00,
// 551 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x53, 0xcd, 0x6e, 0xd3, 0x4c,
0x14, 0xcd, 0xc4, 0x4e, 0xe2, 0xdc, 0xa4, 0xad, 0x35, 0xad, 0x3e, 0x8d, 0xaa, 0x4f, 0x96, 0xf1,
0x02, 0xcc, 0x26, 0x8b, 0x80, 0xd8, 0xa7, 0x96, 0x11, 0x56, 0x8b, 0x5b, 0xc6, 0x89, 0x58, 0x56,
0xfe, 0x6b, 0x64, 0xd1, 0x7a, 0x46, 0xe3, 0x29, 0x22, 0x6f, 0xc1, 0x53, 0xf0, 0x2c, 0x2c, 0xbb,
0x64, 0x89, 0xda, 0x15, 0x6f, 0x81, 0x66, 0x1c, 0x27, 0x65, 0x37, 0xe7, 0xdc, 0x73, 0xee, 0xf5,
0xcc, 0x3d, 0x06, 0xa8, 0x32, 0xc9, 0x67, 0x5c, 0x30, 0xc9, 0x70, 0x9f, 0x67, 0xa7, 0x93, 0x2c,
0x6d, 0xaa, 0xbc, 0x25, 0xbc, 0x1f, 0x06, 0x98, 0xd1, 0xd9, 0xf2, 0x0a, 0x63, 0x30, 0x6f, 0x04,
0xbb, 0x23, 0xc8, 0x45, 0xfe, 0x98, 0xea, 0x33, 0x3e, 0x84, 0xbe, 0x64, 0xa4, 0xaf, 0x99, 0xbe,
0x64, 0xf8, 0x04, 0x06, 0x35, 0xab, 0xf3, 0x92, 0x18, 0x2e, 0xf2, 0x4d, 0xda, 0x02, 0xfc, 0x02,
0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f, 0x0e, 0x7a, 0x78, 0x74, 0xd0, 0xef, 0x47, 0x07, 0x7d, 0x7f, 0x72, 0x7a, 0x0f, 0x4f, 0x4e,
0xef, 0xd7, 0x93, 0xd3, 0xcb, 0x86, 0xfa, 0x0f, 0x79, 0xf3, 0x37, 0x00, 0x00, 0xff, 0xff, 0xf4,
0x8e, 0xc3, 0xc2, 0x40, 0x03, 0x00, 0x00,
}
func (m *IBTP) Marshal() (dAtA []byte, err error) {
......
......@@ -7,13 +7,11 @@ import "basic.proto";
// Inter-blockchain Transfer Protocol
message IBTP {
enum Type {
INTERCHAIN = 0;
RECEIPT_SUCCESS = 1;
RECEIPT_FAILURE = 2;
ASSET_EXCHANGE_INIT = 3;
ASSET_EXCHANGE_REDEEM = 4;
ASSET_EXCHANGE_REFUND = 5;
ASSET_EXCHANGE_RECEIPT = 6;
INTERCHAIN = 0;
RECEIPT_SUCCESS = 1;
RECEIPT_FAILURE = 2;
ROLLBACK = 3;
RECEIPT_ROLLBACK = 4;
}
enum Category {
......@@ -62,4 +60,4 @@ message content {
message IBTPs {
repeated IBTP ibtps = 1;
}
\ No newline at end of file
}
......@@ -152,18 +152,12 @@ func (g *GRPCClient) Initialize(configPath string, ID string, extra []byte) erro
ConfigPath: configPath,
Extra: extra,
})
if err != nil {
return err
}
return nil
return err
}
func (g *GRPCClient) Start() error {
_, err := g.client.Start(g.doneContext, &pb.Empty{})
if err != nil {
return err
}
return nil
return err
}
func (g *GRPCClient) Stop() error {
......
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