Commit 83a7a649 authored by mdj33's avatar mdj33 Committed by vipwzw

add game para chain

parent 40bb46f6
...@@ -25,12 +25,17 @@ services: ...@@ -25,12 +25,17 @@ services:
expose: expose:
- "8802" - "8802"
chain29:
entrypoint: /root/entrypoint.sh
environment:
PARAFILE: "/root/chain33.para29.toml"
nginx: nginx:
image: nginx:latest image: nginx:latest
depends_on: depends_on:
- chain33 - chain33
- chain30 - chain30
- chain29
volumes: volumes:
- ./nginx.conf:/etc/nginx/nginx.conf - ./nginx.conf:/etc/nginx/nginx.conf
expose: expose:
......
This diff is collapsed.
...@@ -1009,10 +1009,18 @@ func (a *action) execCrossTxs(status *pt.ParacrossNodeStatus) (*types.Receipt, e ...@@ -1009,10 +1009,18 @@ func (a *action) execCrossTxs(status *pt.ParacrossNodeStatus) (*types.Receipt, e
func (a *action) AssetTransfer(transfer *types.AssetsTransfer) (*types.Receipt, error) { func (a *action) AssetTransfer(transfer *types.AssetsTransfer) (*types.Receipt, error) {
clog.Debug("Paracross.Exec", "AssetTransfer", transfer.Cointoken, "transfer", "") clog.Debug("Paracross.Exec", "AssetTransfer", transfer.Cointoken, "transfer", "")
//rbk fork后 如果没有nodegroup conf,也不允许跨链
if a.api.GetConfig().IsDappFork(a.height, pt.ParaX, pt.ForkParaAssetTransferRbk) {
err := a.isAllowTransfer()
if err != nil {
return nil, errors.Wrap(err, "AssetTransfer not allow")
}
}
receipt, err := a.assetTransfer(transfer) receipt, err := a.assetTransfer(transfer)
if err != nil { if err != nil {
clog.Error("AssetTransfer failed", "err", err) return nil, errors.Wrap(err, "AssetTransfer failed")
return nil, errors.Cause(err)
} }
return receipt, nil return receipt, nil
} }
...@@ -1026,6 +1034,14 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt, ...@@ -1026,6 +1034,14 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt,
} }
} }
//rbk fork后 如果没有nodegroup conf,也不允许跨链
if cfg.IsDappFork(a.height, pt.ParaX, pt.ForkParaAssetTransferRbk) {
err := a.isAllowTransfer()
if err != nil {
return nil, errors.Wrap(err, "AssetTransfer not allow")
}
}
isPara := cfg.IsPara() isPara := cfg.IsPara()
if !isPara { if !isPara {
// 需要平行链先执行, 达成共识时,继续执行 // 需要平行链先执行, 达成共识时,继续执行
...@@ -1035,8 +1051,7 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt, ...@@ -1035,8 +1051,7 @@ func (a *action) AssetWithdraw(withdraw *types.AssetsWithdraw) (*types.Receipt,
"txHash", common.ToHex(a.tx.Hash()), "token name", withdraw.Cointoken) "txHash", common.ToHex(a.tx.Hash()), "token name", withdraw.Cointoken)
receipt, err := a.assetWithdraw(withdraw, a.tx) receipt, err := a.assetWithdraw(withdraw, a.tx)
if err != nil { if err != nil {
clog.Error("AssetWithdraw failed", "err", err) return nil, errors.Wrap(err, "AssetWithdraw failed")
return nil, errors.Cause(err)
} }
return receipt, nil return receipt, nil
} }
...@@ -1046,9 +1061,14 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec ...@@ -1046,9 +1061,14 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec
cfg := a.api.GetConfig() cfg := a.api.GetConfig()
isPara := cfg.IsPara() isPara := cfg.IsPara()
err := a.isAllowTransfer()
if err != nil {
return nil, errors.Wrap(err, "CrossAssetTransfer not Allow")
}
act, err := getCrossAction(transfer, string(a.tx.Execer)) act, err := getCrossAction(transfer, string(a.tx.Execer))
if act == pt.ParacrossNoneTransfer { if act == pt.ParacrossNoneTransfer {
return nil, err return nil, errors.Wrap(err, "CrossAssetTransfer non action")
} }
// 需要平行链先执行, 达成共识时,继续执行 // 需要平行链先执行, 达成共识时,继续执行
if !isPara && (act == pt.ParacrossMainWithdraw || act == pt.ParacrossParaTransfer) { if !isPara && (act == pt.ParacrossMainWithdraw || act == pt.ParacrossParaTransfer) {
...@@ -1056,8 +1076,7 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec ...@@ -1056,8 +1076,7 @@ func (a *action) CrossAssetTransfer(transfer *pt.CrossAssetTransfer) (*types.Rec
} }
receipt, err := a.crossAssetTransfer(transfer, act, a.tx) receipt, err := a.crossAssetTransfer(transfer, act, a.tx)
if err != nil { if err != nil {
clog.Error("CrossAssetTransfer failed", "err", err) return nil, errors.Wrap(err, "CrossAssetTransfer failed")
return nil, err
} }
return receipt, nil return receipt, nil
} }
...@@ -1129,6 +1148,21 @@ func getTitleFrom(exec []byte) ([]byte, error) { ...@@ -1129,6 +1148,21 @@ func getTitleFrom(exec []byte) ([]byte, error) {
return exec[:last+1], nil return exec[:last+1], nil
} }
func (a *action) isAllowTransfer() error {
tit, err := getTitleFrom(a.tx.Execer)
if err != nil {
return errors.Wrapf(types.ErrInvalidParam, "CrossAssetTransfer, not para chain exec=%s", string(a.tx.Execer))
}
nodes, err := a.getNodesGroup(string(tit))
if err != nil {
return errors.Wrapf(err, "CrossAssetTransfer get nodegroup err,title=%s", tit)
}
if len(nodes) == 0 {
return errors.Wrapf(err, "CrossAssetTransfer nodegroup not create,title=%s", tit)
}
return nil
}
/* /*
func (a *Paracross) CrossLimits(tx *types.Transaction, index int) bool { func (a *Paracross) CrossLimits(tx *types.Transaction, index int) bool {
if tx.GroupCount < 2 { if tx.GroupCount < 2 {
......
This diff is collapsed.
...@@ -67,7 +67,7 @@ func (e *Paracross) Exec_CrossAssetTransfer(payload *pt.CrossAssetTransfer, tx * ...@@ -67,7 +67,7 @@ func (e *Paracross) Exec_CrossAssetTransfer(payload *pt.CrossAssetTransfer, tx *
receipt, err := a.CrossAssetTransfer(payload) receipt, err := a.CrossAssetTransfer(payload)
if err != nil { if err != nil {
clog.Error("Paracross CrossAssetTransfer failed", "error", err, "hash", hex.EncodeToString(tx.Hash())) clog.Error("Paracross CrossAssetTransfer failed", "error", err, "hash", hex.EncodeToString(tx.Hash()))
return nil, errors.Cause(err) return nil, err
} }
return receipt, nil return receipt, nil
} }
......
...@@ -701,7 +701,7 @@ func (a *action) nodeGroupCoinsFrozen(createAddr string, configCoinsFrozen int64 ...@@ -701,7 +701,7 @@ func (a *action) nodeGroupCoinsFrozen(createAddr string, configCoinsFrozen int64
conf := types.ConfSub(cfg, pt.ParaX) conf := types.ConfSub(cfg, pt.ParaX)
confCoins := conf.GInt("nodeGroupFrozenCoins") confCoins := conf.GInt("nodeGroupFrozenCoins")
if configCoinsFrozen < confCoins { if configCoinsFrozen < confCoins {
return nil, pt.ErrParaNodeGroupFrozenCoinsNotEnough return nil, errors.Wrapf(pt.ErrParaNodeGroupFrozenCoinsNotEnough, "nodeGroupCoinsFrozen apply=%d,conf=%d", configCoinsFrozen, confCoins)
} }
if configCoinsFrozen == 0 { if configCoinsFrozen == 0 {
clog.Info("node group apply configCoinsFrozen is 0") clog.Info("node group apply configCoinsFrozen is 0")
......
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