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
92ff2bd3
Commit
92ff2bd3
authored
Jul 11, 2019
by
mdj33
Committed by
vipwzw
Jul 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ut
parent
42c9be94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
paracross_test.go
plugin/dapp/paracross/executor/paracross_test.go
+6
-4
paracross.go
plugin/dapp/paracross/types/paracross.go
+2
-0
No files found.
plugin/dapp/paracross/executor/paracross_test.go
View file @
92ff2bd3
...
@@ -109,6 +109,7 @@ func (suite *CommitTestSuite) SetupSuite() {
...
@@ -109,6 +109,7 @@ func (suite *CommitTestSuite) SetupSuite() {
Block
:
&
types
.
Block
{},
Block
:
&
types
.
Block
{},
}
}
MainBlockHash10
=
blockDetail
.
Block
.
Hash
()
MainBlockHash10
=
blockDetail
.
Block
.
Hash
()
blockDetail
.
Block
.
MainHash
=
MainBlockHash10
// setup title nodes : len = 4
// setup title nodes : len = 4
nodeConfigKey
:=
calcManageConfigNodesKey
(
Title
)
nodeConfigKey
:=
calcManageConfigNodesKey
(
Title
)
...
@@ -133,8 +134,12 @@ func (suite *CommitTestSuite) SetupSuite() {
...
@@ -133,8 +134,12 @@ func (suite *CommitTestSuite) SetupSuite() {
suite
.
api
.
On
(
"GetBlockByHashes"
,
hashes
)
.
Return
(
suite
.
api
.
On
(
"GetBlockByHashes"
,
hashes
)
.
Return
(
&
types
.
BlockDetails
{
&
types
.
BlockDetails
{
Items
:
[]
*
types
.
BlockDetail
{
blockDetail
},
Items
:
[]
*
types
.
BlockDetail
{
blockDetail
},
},
nil
)
.
Once
()
suite
.
api
.
On
(
"GetBlocks"
,
&
types
.
ReqBlocks
{
Start
:
TitleHeight
,
End
:
TitleHeight
})
.
Return
(
&
types
.
BlockDetails
{
Items
:
[]
*
types
.
BlockDetail
{
blockDetail
},
},
nil
)
},
nil
)
suite
.
api
.
On
(
"GetBlockHash"
,
&
types
.
ReqInt
{
Height
:
MainBlock
Height
})
.
Return
(
suite
.
api
.
On
(
"GetBlockHash"
,
&
types
.
ReqInt
{
Height
:
Title
Height
})
.
Return
(
&
types
.
ReplyHash
{
Hash
:
CurBlock
},
nil
)
&
types
.
ReplyHash
{
Hash
:
CurBlock
},
nil
)
}
}
...
@@ -805,9 +810,6 @@ func TestUpdateCommitBlockHashs(t *testing.T) {
...
@@ -805,9 +810,6 @@ func TestUpdateCommitBlockHashs(t *testing.T) {
}
}
updateCommitBlockHashs
(
stat
,
commit2
)
updateCommitBlockHashs
(
stat
,
commit2
)
assert
.
Equal
(
t
,
int
(
2
),
len
(
stat
.
BlockDetails
.
BlockHashs
))
assert
.
Equal
(
t
,
int
(
2
),
len
(
stat
.
BlockDetails
.
BlockHashs
))
assert
.
Equal
(
t
,
int
(
2
),
len
(
stat
.
BlockDetails
.
CrossTxHashs
))
assert
.
Equal
(
t
,
commit2
.
BlockHash
,
stat
.
BlockDetails
.
BlockHashs
[
1
])
assert
.
Equal
(
t
,
commit2
.
BlockHash
,
stat
.
BlockDetails
.
BlockHashs
[
1
])
assert
.
Equal
(
t
,
commit
.
CrossTxHashs
[
0
],
stat
.
BlockDetails
.
CrossTxHashs
[
0
])
assert
.
Equal
(
t
,
commit2
.
CrossTxHashs
[
0
],
stat
.
BlockDetails
.
CrossTxHashs
[
1
])
}
}
plugin/dapp/paracross/types/paracross.go
View file @
92ff2bd3
...
@@ -309,6 +309,7 @@ func (p ParacrossType) CreateRawTransferTx(action string, param json.RawMessage)
...
@@ -309,6 +309,7 @@ func (p ParacrossType) CreateRawTransferTx(action string, param json.RawMessage)
return
tx
,
nil
return
tx
,
nil
}
}
//GetDappForkHeight get paracross dapp fork height
func
GetDappForkHeight
(
forkKey
string
)
int64
{
func
GetDappForkHeight
(
forkKey
string
)
int64
{
var
forkHeight
int64
var
forkHeight
int64
if
types
.
IsPara
()
{
if
types
.
IsPara
()
{
...
@@ -340,6 +341,7 @@ func GetDappForkHeight(forkKey string) int64 {
...
@@ -340,6 +341,7 @@ func GetDappForkHeight(forkKey string) int64 {
return
forkHeight
return
forkHeight
}
}
// IsParaForkHeight check height more than fork height
func
IsParaForkHeight
(
height
int64
,
forkKey
string
)
bool
{
func
IsParaForkHeight
(
height
int64
,
forkKey
string
)
bool
{
return
height
>=
GetDappForkHeight
(
forkKey
)
return
height
>=
GetDappForkHeight
(
forkKey
)
}
}
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