Commit b505b811 authored by suyanlong's avatar suyanlong

refactor code

parent c3771bb0
......@@ -94,7 +94,7 @@ func (e *Evmxgo) ID() string {
}
// configPath 完整路径
func (e *Evmxgo) Initialize(configPath string, ID string, extra []byte) error {
func (e *Evmxgo) Initialize(configPath string, _ string, _ []byte) error {
// 初始化e.client工作
e.eventC = make(chan *pb.IBTP, 10)
e.done = make(chan bool)
......@@ -110,7 +110,7 @@ func (e *Evmxgo) Initialize(configPath string, ID string, extra []byte) error {
e.fromID = chain33Config.Router.FromChain
e.toID = chain33Config.Router.ToChain
e.fee = chain33Config.Chain33.Fee
// logger.SetLevel(hclog.LevelFromString(chain33Config.Log.Level))
logger.SetLevel(hclog.LevelFromString(chain33Config.Log.Level))
// 初始化chain33 client rpc
client, err := rpc.NewClient("", chain33Config.Chain33.Addr)
......@@ -233,7 +233,7 @@ func (e *Evmxgo) pollAppChain() chan *types.Event {
Contract: &types.Contract{
ChainID: e.fromID,
ExecName: ID,
Address: address.ExecAddress(ID), // TODO 合约地址
Address: address.ExecAddress(ID), // 合约地址
CallMethod: evmxgotypes.NameMintMapAction,
},
Payload: &types.MapAssetInfo{
......@@ -290,7 +290,7 @@ func (e *Evmxgo) pollAppChain() chan *types.Event {
Contract: &types.Contract{
ChainID: cast.ToString(e.chainID),
ExecName: ID,
Address: address.ExecAddress(ID), // TODO 合约地址
Address: address.ExecAddress(ID), // 合约地址
CallMethod: evmxgotypes.NameBurnMapAction,
},
Payload: &types.MapAssetInfo{
......@@ -305,9 +305,7 @@ func (e *Evmxgo) pollAppChain() chan *types.Event {
}
e.saveBurn(event)
e.saveUndoneEvent(event)
ch <- event // 需要保存这个事件,用于确认销毁成功。
// TODO 在公链一侧,用户发起注销,余额不够,交易失败.
// e.deleteUndoneEvent(srcEvent.TxID)
ch <- event
break
}
}
......@@ -318,6 +316,7 @@ func (e *Evmxgo) pollAppChain() chan *types.Event {
"height:", item.Block.Height,
"tx:", util.FormatJSON(tx),
)
// 指定交易更新
case types33.ExecErr: // Error
logger.Error("exec error ",
......
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