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
313ebdac
Commit
313ebdac
authored
Nov 06, 2020
by
QM
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updata
parent
e98a4ba2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
24 deletions
+19
-24
action.go
plugin/dapp/paracross/executor/action.go
+6
-11
kv.go
plugin/dapp/paracross/executor/kv.go
+12
-12
query.go
plugin/dapp/paracross/executor/query.go
+1
-1
No files found.
plugin/dapp/paracross/executor/action.go
View file @
313ebdac
...
...
@@ -303,23 +303,18 @@ func (a *action) getNodesGroup(title string) (map[string]struct{}, []string, err
return
nodes
,
nodesArray
,
err
}
func
getSupervision
ConfigNode
s
(
db
dbm
.
KV
,
title
string
)
(
map
[
string
]
struct
{},
[]
string
,
[]
byte
,
error
)
{
func
getSupervision
NodeGroupAddr
s
(
db
dbm
.
KV
,
title
string
)
(
map
[
string
]
struct
{},
[]
string
,
[]
byte
,
error
)
{
key
:=
calcParaSupervisionNodeGroupAddrsKey
(
title
)
nodes
,
nodesArray
,
err
:=
getNodes
(
db
,
key
)
if
err
!=
nil
{
if
errors
.
Cause
(
err
)
!=
pt
.
ErrTitleNotExist
{
return
nil
,
nil
,
nil
,
errors
.
Wrapf
(
err
,
"getSupervisionNode
sGroup
para for title:%s"
,
title
)
return
nil
,
nil
,
nil
,
errors
.
Wrapf
(
err
,
"getSupervisionNode
GroupAddrs
para for title:%s"
,
title
)
}
}
return
nodes
,
nodesArray
,
key
,
nil
}
func
(
a
*
action
)
getSupervisionNodesGroup
(
title
string
)
(
map
[
string
]
struct
{},
[]
string
,
error
)
{
nodes
,
nodesArray
,
_
,
err
:=
getSupervisionConfigNodes
(
a
.
db
,
title
)
return
nodes
,
nodesArray
,
err
}
func
(
a
*
action
)
isValidSuperNode
(
addr
string
)
error
{
cfg
:=
a
.
api
.
GetConfig
()
nodes
,
_
,
err
:=
getParacrossNodes
(
a
.
db
,
cfg
.
GetTitle
())
...
...
@@ -571,9 +566,9 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
}
// 获取监督节点的数据
supervisionNodesMap
,
supervisionNodesArry
,
err
:=
a
.
getSupervisionNodesGroup
(
commit
.
Status
.
Title
)
supervisionNodesMap
,
supervisionNodesArry
,
_
,
err
:=
getSupervisionNodeGroupAddrs
(
a
.
db
,
commit
.
Status
.
Title
)
if
err
!=
nil
&&
errors
.
Cause
(
err
)
!=
pt
.
ErrTitleNotExist
{
return
nil
,
errors
.
Wrap
(
err
,
"getSupervisionNode
sGroup
"
)
return
nil
,
errors
.
Wrap
(
err
,
"getSupervisionNode
GroupAddrs
"
)
}
if
!
bIsCommitSuperNode
{
...
...
@@ -859,9 +854,9 @@ func (a *action) loopCommitTxDone(title string) (*types.Receipt, error) {
return
nil
,
errors
.
Wrapf
(
err
,
"getNodes for title:%s"
,
title
)
}
// 获取监督节点的数据
supervisionNodes
,
_
,
err
:=
a
.
getSupervisionNodesGroup
(
title
)
supervisionNodes
,
_
,
_
,
err
:=
getSupervisionNodeGroupAddrs
(
a
.
db
,
title
)
if
err
!=
nil
&&
errors
.
Cause
(
err
)
!=
pt
.
ErrTitleNotExist
{
return
nil
,
errors
.
Wrap
(
err
,
"getSupervisionNode
sGroup
loopCommitTxDone"
)
return
nil
,
errors
.
Wrap
(
err
,
"getSupervisionNode
GroupAddrs
loopCommitTxDone"
)
}
//从当前共识高度开始遍历
titleStatus
,
err
:=
getTitle
(
a
.
db
,
calcTitleKey
(
title
))
...
...
plugin/dapp/paracross/executor/kv.go
View file @
313ebdac
...
...
@@ -195,18 +195,6 @@ func calcLocalNodeGroupAllPrefix() []byte {
return
[]
byte
(
fmt
.
Sprintf
(
localNodeGroupStatusTitle
))
}
func
calcLocalSupervisionNodeStatusTitle
(
title
string
,
status
int32
,
addr
,
id
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localSupervisionNodeStatusTitle
+
"%s-%02d-%s-%s-%s"
,
title
,
status
,
addr
,
id
))
}
func
calcLocalSupervisionNodeStatusTitlePrefix
(
title
string
,
status
int32
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localSupervisionNodeStatusTitle
+
"%s-%02d"
,
title
,
status
))
}
func
calcLocalSupervisionNodeStatusTitleAllPrefix
(
title
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localSupervisionNodeStatusTitle
+
"%s-"
,
title
))
}
//bind miner
func
calcParaBindMinerAddr
(
node
,
bind
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
paraBindMinderAddr
+
"%s-%s"
,
node
,
bind
))
...
...
@@ -223,3 +211,15 @@ func calcParaSupervisionNodeGroupAddrsKey(title string) []byte {
func
calcParaSupervisionNodeIDKey
(
title
,
hash
string
)
string
{
return
fmt
.
Sprintf
(
paraSupervisionNodeIDPrefix
+
"%s-%s"
,
title
,
hash
)
}
func
calcLocalSupervisionNodeStatusTitle
(
title
string
,
status
int32
,
addr
,
id
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localSupervisionNodeStatusTitle
+
"%s-%02d-%s-%s-%s"
,
title
,
status
,
addr
,
id
))
}
func
calcLocalSupervisionNodeStatusTitlePrefix
(
title
string
,
status
int32
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localSupervisionNodeStatusTitle
+
"%s-%02d"
,
title
,
status
))
}
func
calcLocalSupervisionNodeStatusTitleAllPrefix
(
title
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localSupervisionNodeStatusTitle
+
"%s-"
,
title
))
}
plugin/dapp/paracross/executor/query.go
View file @
313ebdac
...
...
@@ -112,7 +112,7 @@ func (p *Paracross) Query_GetSupervisionNodeGroupAddrs(in *pt.ReqParacrossNodeIn
return
nil
,
errors
.
Wrap
(
types
.
ErrInvalidParam
,
"title is null"
)
}
_
,
nodesArry
,
key
,
err
:=
getSupervision
ConfigNode
s
(
p
.
GetStateDB
(),
in
.
GetTitle
())
_
,
nodesArry
,
key
,
err
:=
getSupervision
NodeGroupAddr
s
(
p
.
GetStateDB
(),
in
.
GetTitle
())
if
err
!=
nil
{
return
nil
,
err
}
...
...
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