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
f7da7639
Commit
f7da7639
authored
Mar 27, 2019
by
mdj33
Committed by
vipwzw
Apr 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add fork
parent
0ad40117
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
9 deletions
+40
-9
action.go
plugin/dapp/paracross/executor/action.go
+35
-9
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+5
-0
No files found.
plugin/dapp/paracross/executor/action.go
View file @
f7da7639
...
...
@@ -59,16 +59,16 @@ func getNodes(db dbm.KV, key []byte) (map[string]struct{}, []string, error) {
// 在配置地址后,发现配置错了, 删除会出现这种情况
return
map
[
string
]
struct
{}{},
nil
,
nil
}
var
nodes
[]
string
uniqNode
:=
make
(
map
[
string
]
struct
{})
var
nodes
Array
[]
string
nodesMap
:=
make
(
map
[
string
]
struct
{})
for
_
,
v
:=
range
value
.
Value
{
if
_
,
exist
:=
uniqNode
[
v
];
!
exist
{
uniqNode
[
v
]
=
struct
{}{}
nodes
=
append
(
nodes
,
v
)
if
_
,
exist
:=
nodesMap
[
v
];
!
exist
{
nodesMap
[
v
]
=
struct
{}{}
nodes
Array
=
append
(
nodesArray
,
v
)
}
}
return
uniqNode
,
nodes
,
nil
return
nodesMap
,
nodesArray
,
nil
}
func
validTitle
(
title
string
)
bool
{
...
...
@@ -214,6 +214,32 @@ func hasCommited(addrs []string, addr string) (bool, int) {
return
false
,
0
}
func
(
a
*
action
)
getNodesGroup
(
title
string
)
(
map
[
string
]
struct
{},
error
)
{
if
!
types
.
IsDappFork
(
a
.
exec
.
GetMainHeight
(),
pt
.
ParaX
,
pt
.
ForkCommitTx
)
{
key
:=
calcManageConfigNodesKey
(
title
)
nodes
,
_
,
err
:=
getNodes
(
a
.
db
,
key
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"getNodes for title:%s"
,
title
)
}
return
nodes
,
nil
}
key
:=
calcParaNodeGroupKey
(
title
)
nodes
,
_
,
err
:=
getNodes
(
a
.
db
,
key
)
if
err
!=
nil
{
if
errors
.
Cause
(
err
)
!=
pt
.
ErrTitleNotExist
{
return
nil
,
errors
.
Wrapf
(
err
,
"getNodes para for title:%s"
,
title
)
}
key
=
calcManageConfigNodesKey
(
title
)
nodes
,
_
,
err
=
getNodes
(
a
.
db
,
key
)
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"getNodes manager for title:%s"
,
title
)
}
}
return
nodes
,
nil
}
func
(
a
*
action
)
Commit
(
commit
*
pt
.
ParacrossCommitAction
)
(
*
types
.
Receipt
,
error
)
{
err
:=
checkCommitInfo
(
commit
)
if
err
!=
nil
{
...
...
@@ -223,10 +249,10 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
if
!
validTitle
(
commit
.
Status
.
Title
)
{
return
nil
,
pt
.
ErrInvalidTitle
}
key
:=
calcParaNodeGroupKey
(
commit
.
Status
.
Title
)
nodes
,
_
,
err
:=
getNodes
(
a
.
db
,
key
)
nodes
,
err
:=
a
.
getNodesGroup
(
commit
.
Status
.
Title
)
if
err
!=
nil
{
return
nil
,
err
ors
.
Wrapf
(
err
,
"getNodes for title:%s"
,
commit
.
Status
.
Title
)
return
nil
,
err
}
if
!
validNode
(
a
.
fromaddr
,
nodes
)
{
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
f7da7639
...
...
@@ -401,11 +401,16 @@ func (a *action) nodeTakeover(config *pt.ParaNodeAddrConfig) (*types.Receipt, er
return
receipt
,
nil
}
//NodeConfig support super account node config
func
(
a
*
action
)
NodeConfig
(
config
*
pt
.
ParaNodeAddrConfig
)
(
*
types
.
Receipt
,
error
)
{
if
!
validTitle
(
config
.
Title
)
{
return
nil
,
pt
.
ErrInvalidTitle
}
if
!
types
.
IsDappFork
(
a
.
exec
.
GetMainHeight
(),
pt
.
ParaX
,
pt
.
ForkCommitTx
)
{
return
nil
,
types
.
ErrNotSupport
}
if
config
.
Op
==
pt
.
ParaNodeJoin
{
if
config
.
Addr
!=
a
.
fromaddr
{
return
nil
,
types
.
ErrFromAddr
...
...
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