Commit 9cddd298 authored by mdj33's avatar mdj33 Committed by vipwzw

adding node not check nodegroup status

parent 978fa4d4
...@@ -191,20 +191,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -191,20 +191,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
} }
func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) { func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) {
key := calcParaNodeGroupKey(config.Title) key := calcParaNodeAddrKey(config.Title, config.Addr)
nodes, _, err := getNodes(a.db, key)
if err != nil {
return nil, errors.Wrapf(err, "getNodes for title:%s", config.Title)
}
if !validNode(a.fromaddr, nodes) {
return nil, errors.Wrapf(pt.ErrParaNodeAddrNotExisted, "nodeAddr not existed:%s", a.fromaddr)
}
//不允许最后一个账户退出
if len(nodes) == 1 {
return nil, errors.Wrapf(pt.ErrParaNodeGroupLastAddr, "nodeAddr last one:%s", a.fromaddr)
}
key = calcParaNodeAddrKey(config.Title, config.Addr)
stat, err := getNodeAddr(a.db, key) stat, err := getNodeAddr(a.db, key)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -214,6 +201,23 @@ func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error) ...@@ -214,6 +201,23 @@ func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
clog.Error("nodeaccount.nodeQuit wrong status", "key", string(key), "status", stat) clog.Error("nodeaccount.nodeQuit wrong status", "key", string(key), "status", stat)
return nil, errors.Wrapf(pt.ErrParaUnSupportNodeOper, "nodeAddr %s was quit status:%d", a.fromaddr, stat.Status) return nil, errors.Wrapf(pt.ErrParaUnSupportNodeOper, "nodeAddr %s was quit status:%d", a.fromaddr, stat.Status)
} }
if stat.Status == pt.ParacrossNodeAdded{
key = calcParaNodeGroupKey(config.Title)
nodes, _, err := getNodes(a.db, key)
if err != nil {
return nil, errors.Wrapf(err, "getNodes for title:%s", config.Title)
}
if !validNode(a.fromaddr, nodes){
return nil, errors.Wrapf(pt.ErrParaNodeAddrNotExisted, "nodeAddr not existed:%s", a.fromaddr)
}
//不允许最后一个账户退出
if len(nodes) == 1 {
return nil, errors.Wrapf(pt.ErrParaNodeGroupLastAddr, "nodeAddr last one:%s", a.fromaddr)
}
}
var copyStat pt.ParaNodeAddrStatus var copyStat pt.ParaNodeAddrStatus
err = deepCopy(&copyStat, stat) err = deepCopy(&copyStat, stat)
if err != nil { if err != nil {
......
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