Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
44b877c3
Commit
44b877c3
authored
Feb 27, 2020
by
mdj33
Committed by
vipwzw
Feb 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only check params in mainchain for nodegroup
parent
3bb4d58b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
15 deletions
+32
-15
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+32
-15
No files found.
plugin/dapp/paracross/executor/superaccount.go
View file @
44b877c3
...
...
@@ -385,7 +385,7 @@ func hasVoted(addrs []string, addr string) (bool, int) {
func
(
a
*
action
)
superManagerVoteProc
(
title
string
)
error
{
status
,
err
:=
getNodeGroupStatus
(
a
.
db
,
title
)
if
err
!=
nil
{
return
err
return
err
ors
.
Wrap
(
err
,
"getNodegroupStatus"
)
}
cfg
:=
a
.
api
.
GetConfig
()
conf
:=
types
.
ConfSub
(
cfg
,
pt
.
ParaX
)
...
...
@@ -393,7 +393,7 @@ func (a *action) superManagerVoteProc(title string) error {
data
,
err
:=
a
.
exec
.
paracrossGetHeight
(
title
)
if
err
!=
nil
{
clog
.
Info
(
"paracross.superManagerVoteProc get consens height"
,
"title"
,
title
,
"err"
,
err
.
Error
())
return
err
return
err
ors
.
Wrap
(
err
,
"getTitleHeight"
)
}
var
consensMainHeight
int64
consensHeight
:=
data
.
(
*
pt
.
ParacrossStatus
)
.
Height
...
...
@@ -404,7 +404,7 @@ func (a *action) superManagerVoteProc(title string) error {
stat
,
err
:=
a
.
exec
.
paracrossGetStateTitleHeight
(
title
,
consensHeight
)
if
err
!=
nil
{
clog
.
Info
(
"paracross.superManagerVoteProc get consens title height"
,
"title"
,
title
,
"conesusHeight"
,
consensHeight
,
"err"
,
err
.
Error
())
return
err
return
err
ors
.
Wrapf
(
err
,
"getStateTitleHeight,consensHeight=%d"
,
consensHeight
)
}
consensMainHeight
=
stat
.
(
*
pt
.
ParacrossHeightStatus
)
.
MainHeight
}
...
...
@@ -476,13 +476,36 @@ func (a *action) updateNodeAddrStatus(stat *pt.ParaNodeIdStatus) (*types.Receipt
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeOpStatusWrong
,
"nodeAddr:%s get wrong status:%d"
,
stat
.
TargetAddr
,
stat
.
Status
)
}
func
(
a
*
action
)
checkIsSuperManagerVote
(
config
*
pt
.
ParaNodeAddrConfig
,
nodes
map
[
string
]
struct
{})
(
bool
,
error
)
{
cfg
:=
a
.
api
.
GetConfig
()
//平行链:主链成功的交易如果不是nodegroup节点,就是superManager,为了不需在平行链配置superManger,间接判断是否是superManager
if
cfg
.
IsPara
()
{
if
validNode
(
a
.
fromaddr
,
nodes
)
{
return
false
,
nil
}
return
true
,
nil
}
//主链:只检查超级管理员处理
if
!
isSuperManager
(
cfg
,
a
.
fromaddr
)
{
return
false
,
nil
}
err
:=
a
.
superManagerVoteProc
(
config
.
Title
)
if
err
!=
nil
{
return
false
,
err
}
return
true
,
nil
}
func
(
a
*
action
)
nodeVote
(
config
*
pt
.
ParaNodeAddrConfig
)
(
*
types
.
Receipt
,
error
)
{
nodes
,
_
,
err
:=
getParacrossNodes
(
a
.
db
,
config
.
Title
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"getNodes for title:%s"
,
config
.
Title
)
}
cfg
:=
a
.
api
.
GetConfig
()
if
!
validNode
(
a
.
fromaddr
,
nodes
)
&&
!
isSuperManager
(
cfg
,
a
.
fromaddr
)
{
//只在主链检查, 只有nodegroup成员和supermanager可以vote
if
!
cfg
.
IsPara
()
&&
!
validNode
(
a
.
fromaddr
,
nodes
)
&&
!
isSuperManager
(
cfg
,
a
.
fromaddr
)
{
return
nil
,
errors
.
Wrapf
(
pt
.
ErrNodeNotForTheTitle
,
"not validNode:%s"
,
a
.
fromaddr
)
}
...
...
@@ -522,16 +545,9 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
most
,
vote
:=
getMostVote
(
stat
.
Votes
)
if
!
isCommitDone
(
nodes
,
most
)
{
superManagerPass
:=
false
if
isSuperManager
(
cfg
,
a
.
fromaddr
)
{
//如果主链执行失败,交易不会过滤到平行链,如果主链成功,平行链直接成功
if
!
cfg
.
IsPara
()
{
err
:=
a
.
superManagerVoteProc
(
config
.
Title
)
if
err
!=
nil
{
return
nil
,
err
}
}
superManagerPass
=
true
superManagerPass
,
err
:=
a
.
checkIsSuperManagerVote
(
config
,
nodes
)
if
err
!=
nil
{
return
nil
,
err
}
//超级用户投yes票,共识停止了一定高度就可以通过,防止当前所有授权节点都忘掉私钥场景
...
...
@@ -921,7 +937,8 @@ func (a *action) nodeGroupApproveApply(config *pt.ParaNodeGroupConfig, apply *pt
// NodeGroupApprove super addr approve the node group apply
func
(
a
*
action
)
nodeGroupApprove
(
config
*
pt
.
ParaNodeGroupConfig
)
(
*
types
.
Receipt
,
error
)
{
cfg
:=
a
.
api
.
GetConfig
()
if
!
isSuperManager
(
cfg
,
a
.
fromaddr
)
{
//只在主链检查
if
!
cfg
.
IsPara
()
&&
!
isSuperManager
(
cfg
,
a
.
fromaddr
)
{
return
nil
,
errors
.
Wrapf
(
types
.
ErrNotAllow
,
"node group approve not super manager:%s"
,
a
.
fromaddr
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment