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
d66b791c
Commit
d66b791c
authored
May 31, 2019
by
mdj33
Committed by
vipwzw
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improves
parent
6fae0e58
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+2
-2
action.go
plugin/dapp/paracross/executor/action.go
+15
-6
query.go
plugin/dapp/paracross/executor/query.go
+2
-2
No files found.
plugin/consensus/para/paracommitmsg.go
View file @
d66b791c
...
@@ -18,8 +18,8 @@ import (
...
@@ -18,8 +18,8 @@ import (
)
)
var
(
var
(
consensusInterval
=
1
6
//about 1 new block interval
consensusInterval
=
1
0
//about 1 new block interval
minerInterval
=
5
minerInterval
=
25
//5s的主块间隔后分叉概率增加,25s可以消除一些分叉回退
)
)
type
commitMsgClient
struct
{
type
commitMsgClient
struct
{
...
...
plugin/dapp/paracross/executor/action.go
View file @
d66b791c
...
@@ -459,10 +459,10 @@ func (a *action) execCrossTx(tx *types.TransactionDetail, commit *pt.ParacrossCo
...
@@ -459,10 +459,10 @@ func (a *action) execCrossTx(tx *types.TransactionDetail, commit *pt.ParacrossCo
}
}
func
getCrossTxHashs
(
api
client
.
QueueProtocolAPI
,
commit
*
pt
.
ParacrossCommitAction
)
([][]
byte
,
[]
byte
,
error
)
{
func
getCrossTxHashs
(
api
client
.
QueueProtocolAPI
,
commit
*
pt
.
ParacrossCommitAction
)
([][]
byte
,
[]
byte
,
error
)
{
crossTxHashs
:=
commit
.
Status
.
CrossTxHashs
crossTxResult
:=
commit
.
Status
.
CrossTxResult
if
types
.
IsDappFork
(
commit
.
Status
.
MainBlockHeight
,
pt
.
ParaX
,
pt
.
ForkCommitTx
)
{
if
types
.
IsDappFork
(
commit
.
Status
.
MainBlockHeight
,
pt
.
ParaX
,
pt
.
ForkCommitTx
)
{
if
len
(
commit
.
Status
.
CrossTxHashs
)
==
0
{
if
len
(
commit
.
Status
.
CrossTxHashs
)
==
0
{
clog
.
Error
(
"getCrossTxHashs len=0"
,
"paraHeight"
,
commit
.
Status
.
Height
,
"mainHeight"
,
commit
.
Status
.
MainBlockHeight
,
"mainHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
MainBlockHash
))
return
nil
,
nil
,
types
.
ErrCheckTxHash
return
nil
,
nil
,
types
.
ErrCheckTxHash
}
}
blockDetail
,
err
:=
GetBlock
(
api
,
commit
.
Status
.
MainBlockHash
)
blockDetail
,
err
:=
GetBlock
(
api
,
commit
.
Status
.
MainBlockHash
)
...
@@ -479,23 +479,32 @@ func getCrossTxHashs(api client.QueueProtocolAPI, commit *pt.ParacrossCommitActi
...
@@ -479,23 +479,32 @@ func getCrossTxHashs(api client.QueueProtocolAPI, commit *pt.ParacrossCommitActi
baseCheckTxHash
:=
CalcTxHashsHash
(
baseHashs
)
baseCheckTxHash
:=
CalcTxHashsHash
(
baseHashs
)
crossCheckHash
:=
CalcTxHashsHash
(
paraCrossHashs
)
crossCheckHash
:=
CalcTxHashsHash
(
paraCrossHashs
)
if
!
bytes
.
Equal
(
commit
.
Status
.
CrossTxHashs
[
0
],
crossCheckHash
)
{
if
!
bytes
.
Equal
(
commit
.
Status
.
CrossTxHashs
[
0
],
crossCheckHash
)
{
clog
.
Error
(
"getCrossTxHashs para hash not equal"
,
"main.crossHash"
,
hex
.
EncodeToString
(
crossCheckHash
),
clog
.
Error
(
"getCrossTxHashs para hash not equal"
,
"paraHeight"
,
commit
.
Status
.
Height
,
"mainHeight"
,
commit
.
Status
.
MainBlockHeight
,
"mainHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
MainBlockHash
),
"main.crossHash"
,
hex
.
EncodeToString
(
crossCheckHash
),
"commit.crossHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
CrossTxHashs
[
0
]),
"commit.crossHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
CrossTxHashs
[
0
]),
"main.baseHash"
,
hex
.
EncodeToString
(
baseCheckTxHash
),
"commit.baseHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
TxHashs
[
0
]))
"main.baseHash"
,
hex
.
EncodeToString
(
baseCheckTxHash
),
"commit.baseHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
TxHashs
[
0
]))
for
_
,
hash
:=
range
baseHashs
{
clog
.
Error
(
"getCrossTxHashs base tx hash"
,
"txhash"
,
hex
.
EncodeToString
(
hash
))
}
for
_
,
hash
:=
range
paraCrossHashs
{
clog
.
Error
(
"getCrossTxHashs paracross tx hash"
,
"txhash"
,
hex
.
EncodeToString
(
hash
))
}
return
nil
,
nil
,
types
.
ErrCheckTxHash
return
nil
,
nil
,
types
.
ErrCheckTxHash
}
}
//只获取跨链tx
//只获取跨链tx
crossTxHashs
=
paraCrossHashs
rst
,
err
:=
hex
.
DecodeString
(
string
(
commit
.
Status
.
CrossTxResult
))
rst
,
err
:=
hex
.
DecodeString
(
string
(
commit
.
Status
.
CrossTxResult
))
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"getCrossTxHashs decode string"
,
"CrossTxResult"
,
string
(
commit
.
Status
.
CrossTxResult
),
clog
.
Error
(
"getCrossTxHashs decode string"
,
"CrossTxResult"
,
string
(
commit
.
Status
.
CrossTxResult
),
"commit.height"
,
commit
.
Status
.
Height
)
"commit.height"
,
commit
.
Status
.
Height
)
return
nil
,
nil
,
types
.
ErrInvalidParam
return
nil
,
nil
,
types
.
ErrInvalidParam
}
}
crossTxResult
=
rst
return
paraCrossHashs
,
rst
,
nil
}
}
return
crossTxHashs
,
crossTxResult
,
nil
return
commit
.
Status
.
CrossTxHashs
,
commit
.
Status
.
CrossTxResult
,
nil
}
}
func
(
a
*
action
)
execCrossTxs
(
commit
*
pt
.
ParacrossCommitAction
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
execCrossTxs
(
commit
*
pt
.
ParacrossCommitAction
)
(
*
types
.
Receipt
,
error
)
{
...
...
plugin/dapp/paracross/executor/query.go
View file @
d66b791c
...
@@ -212,7 +212,7 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) {
...
@@ -212,7 +212,7 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) {
MostSameCommit
:
st
.
MostSameCommit
,
MostSameCommit
:
st
.
MostSameCommit
,
Title
:
st
.
Title
,
Title
:
st
.
Title
,
Height
:
st
.
Height
,
Height
:
st
.
Height
,
StateHash
:
hex
.
EncodeToString
(
st
.
StateHash
),
StateHash
:
common
.
ToHex
(
st
.
StateHash
),
TxCounts
:
st
.
TxCounts
,
TxCounts
:
st
.
TxCounts
,
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
}
}
...
@@ -287,7 +287,7 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
...
@@ -287,7 +287,7 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
MostSameCommit
:
st
.
MostSameCommit
,
MostSameCommit
:
st
.
MostSameCommit
,
Title
:
st
.
Title
,
Title
:
st
.
Title
,
Height
:
st
.
Height
,
Height
:
st
.
Height
,
StateHash
:
hex
.
EncodeToString
(
st
.
StateHash
),
StateHash
:
common
.
ToHex
(
st
.
StateHash
),
TxCounts
:
st
.
TxCounts
,
TxCounts
:
st
.
TxCounts
,
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
},
nil
},
nil
...
...
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