Commit fe155cbb authored by suyanlong's avatar suyanlong

fix bug for execname

parent b6c52534
...@@ -334,7 +334,7 @@ func (p *Paracross) processBlock(height, end int64) { ...@@ -334,7 +334,7 @@ func (p *Paracross) processBlock(height, end int64) {
if err != nil { if err != nil {
p.logger.Error("types33.Decode(unlock.Note, srcEvent) error:", "error", err) p.logger.Error("types33.Decode(unlock.Note, srcEvent) error:", "error", err)
} }
p.updateBurnUnlock(srcEvent, p.unLockEvent(unlock, tx, height1)) p.updateBurnUnlock(srcEvent, p.unLockEvent(unlock.Amount, unlock.To, unlock.Cointoken, "AssetWithdraw", unlock.Note, tx, height1))
p.logger.Info("unlock <=> unLockEvent succeed!", "tx", util.FormatJSON(string(t))) p.logger.Info("unlock <=> unLockEvent succeed!", "tx", util.FormatJSON(string(t)))
}, },
paracorssTypes.ParacrossActionAssetTransfer: func() { paracorssTypes.ParacrossActionAssetTransfer: func() {
...@@ -358,7 +358,17 @@ func (p *Paracross) processBlock(height, end int64) { ...@@ -358,7 +358,17 @@ func (p *Paracross) processBlock(height, end int64) {
if bytes.Equal(p.privateKey.PubKey().Bytes(), tx.Signature.Pubkey) { if bytes.Equal(p.privateKey.PubKey().Bytes(), tx.Signature.Pubkey) {
unDoneTx = append(unDoneTx, tx.Hash()) unDoneTx = append(unDoneTx, tx.Hash())
hashData = append(hashData, tx.Hash()...) hashData = append(hashData, tx.Hash()...)
p.saveUnLock(p.unLockEvent(action.GetAssetWithdraw(), tx, height1)) unlock := action.GetAssetWithdraw()
p.saveUnLock(p.unLockEvent(unlock.Amount, unlock.To, unlock.Cointoken, "AssetWithdraw", unlock.Note, tx, height1))
}
},
paracorssTypes.ParacrossActionCrossAssetTransfer: func() {
// pack的交易,在只后的高度,受一定的条件触发,会再次执行,并且包含在当前高度之中的,以及执行的recipt。可以这样的获取。
if bytes.Equal(p.privateKey.PubKey().Bytes(), tx.Signature.Pubkey) {
unDoneTx = append(unDoneTx, tx.Hash())
hashData = append(hashData, tx.Hash()...)
unlock := action.GetCrossAssetTransfer()
p.saveUnLock(p.unLockEvent(unlock.Amount, unlock.ToAddr, unlock.AssetSymbol, "CrossAssetTransfer", []byte(unlock.Note), tx, height1))
} }
}, },
paracorssTypes.ParacrossActionCommit: func() { paracorssTypes.ParacrossActionCommit: func() {
...@@ -507,7 +517,7 @@ func (p *Paracross) lockCrossEvent(lock *paracorssTypes.CrossAssetTransfer, tx * ...@@ -507,7 +517,7 @@ func (p *Paracross) lockCrossEvent(lock *paracorssTypes.CrossAssetTransfer, tx *
return event return event
} }
func (p *Paracross) unLockEvent(unlock *types33.AssetsWithdraw, tx *types33.Transaction, height int64) *types.Event { func (p *Paracross) unLockEvent(amount int64, to, token, method string, note []byte, tx *types33.Transaction, height int64) *types.Event {
event := &types.Event{ event := &types.Event{
TxID: util.ToHex(tx.Hash()), TxID: util.ToHex(tx.Hash()),
BlockNumber: uint64(height), BlockNumber: uint64(height),
...@@ -515,14 +525,14 @@ func (p *Paracross) unLockEvent(unlock *types33.AssetsWithdraw, tx *types33.Tran ...@@ -515,14 +525,14 @@ func (p *Paracross) unLockEvent(unlock *types33.AssetsWithdraw, tx *types33.Tran
ChainID: cast.ToString(p.chainID), ChainID: cast.ToString(p.chainID),
ExecName: execer, ExecName: execer,
Address: p.execAddress, // 合约地址 Address: p.execAddress, // 合约地址
CallMethod: "AssetsWithdraw", CallMethod: method,
}, },
Payload: &types.MapAssetInfo{ Payload: &types.MapAssetInfo{
EventType: types.EventType_UnLock, EventType: types.EventType_UnLock,
UnlockAddress: unlock.To, // 用户地址 UnlockAddress: to, // 用户地址
UnlockAmount: unlock.Amount, UnlockAmount: amount,
Symbol: types.Symbol(unlock.Cointoken), Symbol: types.Symbol(token),
Extra: unlock.Note, Extra: note,
Height: height, Height: height,
Nonce: tx.Nonce, Nonce: tx.Nonce,
}, },
...@@ -786,7 +796,7 @@ func (p *Paracross) CreateRawAssetTransferTxExt(param *types33.CreateTx) (*types ...@@ -786,7 +796,7 @@ func (p *Paracross) CreateRawAssetTransferTxExt(param *types33.CreateTx) (*types
AssetSymbol: param.TokenSymbol, AssetSymbol: param.TokenSymbol,
Amount: param.Amount, Amount: param.Amount,
ToAddr: param.GetTo(), ToAddr: param.GetTo(),
//Note: string(param.GetNote()), // Note: string(param.GetNote()),
}} }}
transfer.Value = v transfer.Value = v
transfer.Ty = paracorssTypes.ParacrossActionCrossAssetTransfer transfer.Ty = paracorssTypes.ParacrossActionCrossAssetTransfer
......
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