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
ec3bd2ee
Commit
ec3bd2ee
authored
Jun 03, 2019
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
c8a9694d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
21 deletions
+18
-21
reward.go
plugin/dapp/paracross/executor/reward.go
+1
-1
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+7
-7
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+10
-13
No files found.
plugin/dapp/paracross/executor/reward.go
View file @
ec3bd2ee
...
...
@@ -62,7 +62,7 @@ func getMiners(detail *pt.ParacrossStatusDetails, blockHash []byte) []string {
//
func
mergeReceipt
(
receipt1
,
receipt2
*
types
.
Receipt
)
*
types
.
Receipt
{
if
receipt2
!=
nil
{
if
receipt2
!=
nil
{
receipt1
.
KV
=
append
(
receipt1
.
KV
,
receipt2
.
KV
...
)
receipt1
.
Logs
=
append
(
receipt1
.
Logs
,
receipt2
.
Logs
...
)
}
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
ec3bd2ee
...
...
@@ -463,14 +463,14 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
if
err
!=
nil
{
return
nil
,
err
}
receipt
=
mergeReceipt
(
receipt
,
r
)
receipt
=
mergeReceipt
(
receipt
,
r
)
stat
.
Status
=
pt
.
ParacrossNodeQuited
if
!
types
.
IsPara
()
{
r
,
err
:=
a
.
nodeGroupCoinsActive
(
stat
.
FromAddr
,
stat
.
CoinsFrozen
,
1
)
if
err
!=
nil
{
return
nil
,
err
}
receipt
=
mergeReceipt
(
receipt
,
r
)
receipt
=
mergeReceipt
(
receipt
,
r
)
}
}
}
else
{
...
...
@@ -480,29 +480,29 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
return
nil
,
err
}
stat
.
Status
=
pt
.
ParacrossNodeJoined
receipt
=
mergeReceipt
(
receipt
,
r
)
receipt
=
mergeReceipt
(
receipt
,
r
)
}
else
if
stat
.
Status
==
pt
.
ParacrossNodeQuiting
{
r
,
err
:=
unpdateNodeGroup
(
a
.
db
,
config
.
Title
,
stat
.
TargetAddr
,
false
)
if
err
!=
nil
{
return
nil
,
err
}
stat
.
Status
=
pt
.
ParacrossNodeQuited
receipt
=
mergeReceipt
(
receipt
,
r
)
receipt
=
mergeReceipt
(
receipt
,
r
)
if
!
types
.
IsPara
()
{
r
,
err
:=
a
.
nodeGroupCoinsActive
(
stat
.
FromAddr
,
stat
.
CoinsFrozen
,
1
)
if
err
!=
nil
{
return
nil
,
err
}
receipt
=
mergeReceipt
(
receipt
,
r
)
receipt
=
mergeReceipt
(
receipt
,
r
)
}
}
}
r
:=
makeNodeConfigReceipt
(
a
.
fromaddr
,
config
,
&
copyStat
,
stat
)
receipt
=
mergeReceipt
(
receipt
,
r
)
receipt
=
mergeReceipt
(
receipt
,
r
)
receiptDone
:=
makeVoteDoneReceipt
(
stat
,
len
(
nodes
),
len
(
stat
.
Votes
.
Addrs
),
most
,
pt
.
ParaNodeVoteStr
[
vote
],
stat
.
Status
)
receipt
=
mergeReceipt
(
receipt
,
receiptDone
)
receipt
=
mergeReceipt
(
receipt
,
receiptDone
)
return
receipt
,
nil
}
...
...
plugin/dapp/paracross/executor/superaccount_test.go
View file @
ec3bd2ee
...
...
@@ -125,7 +125,6 @@ func checkGroupApproveReceipt(suite *NodeManageTestSuite, receipt *types.Receipt
len
:=
len
(
receipt
.
KV
)
var
stat
pt
.
ParaNodeIdStatus
err
:=
types
.
Decode
(
receipt
.
KV
[
len
-
1
]
.
Value
,
&
stat
)
assert
.
Nil
(
suite
.
T
(),
err
,
"decode ParaNodeAddrStatus failed"
)
...
...
@@ -179,8 +178,7 @@ func checkVoteDoneReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, co
suite
.
NotNil
(
receipt
)
assert
.
Equal
(
suite
.
T
(),
receipt
.
Ty
,
int32
(
types
.
ExecOk
))
suite
.
T
()
.
Log
(
"checkVoteDoneReceipt"
,
"kvlen"
,
len
(
receipt
.
KV
))
suite
.
T
()
.
Log
(
"checkVoteDoneReceipt"
,
"kvlen"
,
len
(
receipt
.
KV
))
_
,
arry
,
err
:=
getParacrossNodes
(
suite
.
stateDB
,
Title
)
suite
.
Suite
.
Nil
(
err
)
...
...
@@ -192,10 +190,10 @@ func checkVoteDoneReceipt(suite *NodeManageTestSuite, receipt *types.Receipt, co
}
func
voteTest
(
suite
*
NodeManageTestSuite
,
id
string
,
join
bool
)
{
var
count
int
=
1
var
count
int
=
1
config
:=
&
pt
.
ParaNodeAddrConfig
{
Op
:
pt
.
ParaNodeVote
,
Id
:
id
,
Id
:
id
,
Value
:
pt
.
ParaNodeVoteYes
,
}
tx
,
err
:=
pt
.
CreateRawNodeConfigTx
(
config
)
...
...
@@ -209,7 +207,7 @@ func voteTest(suite *NodeManageTestSuite, id string, join bool) {
checkVoteReceipt
(
suite
,
receipt
,
count
)
count
++
if
!
join
{
if
!
join
{
receipt
=
nodeCommit
(
suite
,
PrivKey14K
,
tx
)
checkVoteReceipt
(
suite
,
receipt
,
count
)
count
++
...
...
@@ -230,14 +228,14 @@ func (suite *NodeManageTestSuite) testNodeGroupConfigQuit() {
receipt
:=
nodeCommit
(
suite
,
PrivKeyB
,
tx
)
checkGroupApplyReceipt
(
suite
,
receipt
)
suite
.
Equal
(
int32
(
pt
.
TyLogParaNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
suite
.
Equal
(
int32
(
pt
.
TyLogParaNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
var
g
pt
.
ReceiptParaNodeGroupConfig
err
=
types
.
Decode
(
receipt
.
Logs
[
0
]
.
Log
,
&
g
)
suite
.
Nil
(
err
)
config
=
&
pt
.
ParaNodeGroupConfig
{
Id
:
g
.
Current
.
Id
,
Op
:
pt
.
ParacrossNodeGroupQuit
,
Op
:
pt
.
ParacrossNodeGroupQuit
,
}
tx
,
err
=
pt
.
CreateRawNodeGroupApplyTx
(
config
)
suite
.
Nil
(
err
)
...
...
@@ -260,15 +258,14 @@ func (suite *NodeManageTestSuite) testNodeGroupConfig() {
receipt
:=
nodeCommit
(
suite
,
PrivKeyB
,
tx
)
checkGroupApplyReceipt
(
suite
,
receipt
)
suite
.
Equal
(
int32
(
pt
.
TyLogParaNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
suite
.
Equal
(
int32
(
pt
.
TyLogParaNodeGroupConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
var
g
pt
.
ReceiptParaNodeGroupConfig
err
=
types
.
Decode
(
receipt
.
Logs
[
0
]
.
Log
,
&
g
)
suite
.
Nil
(
err
)
config
=
&
pt
.
ParaNodeGroupConfig
{
Id
:
g
.
Current
.
Id
,
Op
:
pt
.
ParacrossNodeGroupApprove
,
Op
:
pt
.
ParacrossNodeGroupApprove
,
}
tx
,
err
=
pt
.
CreateRawNodeGroupApplyTx
(
config
)
suite
.
Nil
(
err
)
...
...
@@ -290,7 +287,7 @@ func (suite *NodeManageTestSuite) testNodeConfig() {
receipt
:=
nodeCommit
(
suite
,
PrivKey14K
,
tx
)
checkJoinReceipt
(
suite
,
receipt
)
suite
.
Equal
(
int32
(
pt
.
TyLogParaNodeConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
suite
.
Equal
(
int32
(
pt
.
TyLogParaNodeConfig
),
receipt
.
Logs
[
0
]
.
Ty
)
var
g
pt
.
ReceiptParaNodeConfig
err
=
types
.
Decode
(
receipt
.
Logs
[
0
]
.
Log
,
&
g
)
suite
.
Nil
(
err
)
...
...
@@ -300,7 +297,7 @@ func (suite *NodeManageTestSuite) testNodeConfig() {
//Quit test
config
=
&
pt
.
ParaNodeAddrConfig
{
Op
:
pt
.
ParaNodeQuit
,
Op
:
pt
.
ParaNodeQuit
,
Id
:
g
.
Current
.
Id
,
}
tx
,
err
=
pt
.
CreateRawNodeConfigTx
(
config
)
...
...
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