Commit dd7fbd8c authored by harrylee's avatar harrylee

update broker

parent e664d86c
Pipeline #8222 failed with stages
in 0 seconds
......@@ -140,14 +140,15 @@ func (b *BrokerDB) updateIndex(payload *brokertypes.UpdateIndex) (*types.Receipt
receipt.Logs = append(receipt.Logs, receiptlog)
return receipt, nil
}
//TODO 重构跨链事件发布
func (b *BrokerDB) emitInterchainEvent(payload *brokertypes.InterchainEvent) (*types.Receipt, error) {
//FIXME 权限检查,是否需要设定指定账户拥有跨链的权限
receipt := &types.Receipt{Ty: types.ExecOk}
//发布跨链事件分为 1.信息跨链 2.代币跨链,代币跨链需要在这步将所需金额冻结在broker下面
if payload.Type == brokertypes.Req_Type_Storage {
//校验存在交易是否存在
params := &storagetypes.QueryStorage{TxHash: payload.Args[0]}
_, err := b.api.Query(storagetypes.StorageX, payload.GetFunc(), params)
params := &storagetypes.QueryStorage{TxHash: payload.Args}
_, err := b.api.Query(storagetypes.StorageX, "QueryStorage", params)
if err != nil {
return nil, brokertypes.ErrBrokerStorageTx
}
......
......@@ -47,8 +47,6 @@ func (m *InterchainEventRow) Get(key string) ([]byte, error) {
return []byte(fmt.Sprintf("%018d", m.Index)), nil
} else if key == "dstServiceID" {
return []byte(fmt.Sprintf("%s", m.GetDstServiceID())), nil
} else if key == "status" {
return []byte(fmt.Sprintf("%d", m.GetStatus())), nil
}else if key == "type" {
return []byte(fmt.Sprintf("%d", m.GetType())), nil
}
......
......@@ -52,7 +52,6 @@ message UpdateIndex {
//响应信息
Response response = 5;
}
// 跨链事件
message InterchainEvent {
//索引值,这个有系统自动生成
......@@ -63,12 +62,16 @@ message InterchainEvent {
string srcServiceID = 3;
//跨链交易类型 0表示storage,1表示coins,2表示token......
uint64 type =4;
//调用方法
//方法集合分别表示 当前,回调,回滚方法 用,号分割 比如: "interchainGet,interchainSet,interchainRollback"
string func = 5;
//参数列表
repeated string args = 6;
string args = 6;
//回调参数
string argscb =7;
//回滚参数
string argsrb =8;
//状态 0表示开始处理 1表示跨链成功 2表示跨链失败
int32 status = 7;
// int32 status = 7;
}
//ReceiptBrokerLog
message ReceiptBrokerLog{
......@@ -95,23 +98,6 @@ message InterChainEventList{
repeated InterchainEvent list =1;
}
////根据状态查看跨链事件
//message QueryInterchainEventList {
// //事件状态必填(默认是0,只查询待处理状态的事件)
// int32 status = 1;
// // 主键索引
// string primaryKey = 2;
// //单页返回多少条记录,默认返回10条,为了系统安全最多单次只能返回20条
// int32 count = 3;
// // 0降序,1升序,默认降序
// int32 direction = 4;
//}
////跨链事件列表
//message InterchainEventList {
// repeated InterchainEvent list = 1;
// string primaryKey = 2;
//}
message QueryNilParam{
}
......
This diff is collapsed.
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