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
2147da5c
Commit
2147da5c
authored
Mar 21, 2019
by
mdj33
Committed by
33cn
Mar 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
para chain check hash in advance
parent
98fd0905
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+1
-1
action.go
plugin/dapp/paracross/executor/action.go
+18
-13
No files found.
plugin/consensus/para/paracommitmsg.go
View file @
2147da5c
...
...
@@ -159,7 +159,7 @@ out:
selfConsensusHeight
:=
rsp
.
selfStatus
.
Height
mainConsensHeight
:=
rsp
.
mainStatus
.
Height
plog
.
Info
(
"para consensus rcv"
,
"notify"
,
notification
,
"sending"
,
len
(
sendingMsgs
),
"mainHeigt"
,
rsp
.
mainStatus
.
Height
,
"main
lockh
ash"
,
common
.
ToHex
(
rsp
.
mainStatus
.
BlockHash
),
"mainHeigt"
,
rsp
.
mainStatus
.
Height
,
"main
H
ash"
,
common
.
ToHex
(
rsp
.
mainStatus
.
BlockHash
),
"selfHeight"
,
rsp
.
selfStatus
.
Height
,
"selfHash"
,
common
.
ToHex
(
rsp
.
selfStatus
.
BlockHash
),
"sync"
,
isSync
)
if
notification
==
nil
||
isRollback
{
...
...
plugin/dapp/paracross/executor/action.go
View file @
2147da5c
...
...
@@ -248,20 +248,25 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
// 主链 (1)Bn1 (3) rollback-Bn1 (4) commit-done in Bn2
// 平行链 (2)commit (5) 将得到一个错误的块
// 所以有必要做这个检测
if
!
types
.
IsPara
()
{
blockHash
,
err
:=
getBlockHash
(
a
.
api
,
commit
.
Status
.
MainBlockHeight
)
if
err
!=
nil
{
clog
.
Error
(
"paracross.Commit getBlockHash"
,
"err"
,
err
,
"commit tx Main.height"
,
commit
.
Status
.
MainBlockHeight
,
"from"
,
a
.
fromaddr
)
return
nil
,
err
}
if
!
bytes
.
Equal
(
blockHash
.
Hash
,
commit
.
Status
.
MainBlockHash
)
&&
commit
.
Status
.
Height
>
0
{
clog
.
Error
(
"paracross.Commit blockHash not match"
,
"db"
,
hex
.
EncodeToString
(
blockHash
.
Hash
),
"commit tx"
,
hex
.
EncodeToString
(
commit
.
Status
.
MainBlockHash
),
"commitHeight"
,
commit
.
Status
.
Height
,
"commitMainHeight"
,
commit
.
Status
.
MainBlockHeight
,
"from"
,
a
.
fromaddr
)
return
nil
,
types
.
ErrBlockHashNoMatch
}
commitHeight
:=
commit
.
Status
.
MainBlockHeight
commitHash
:=
commit
.
Status
.
MainBlockHash
if
types
.
IsPara
()
{
commitHeight
=
commit
.
Status
.
Height
commitHash
=
commit
.
Status
.
BlockHash
}
blockHash
,
err
:=
getBlockHash
(
a
.
api
,
commitHeight
)
if
err
!=
nil
{
clog
.
Error
(
"paracross.Commit getBlockHash"
,
"err"
,
err
,
"commit tx height"
,
commitHeight
,
"isMain"
,
!
types
.
IsPara
(),
"from"
,
a
.
fromaddr
)
return
nil
,
err
}
if
!
bytes
.
Equal
(
blockHash
.
Hash
,
commitHash
)
&&
commit
.
Status
.
Height
>
0
{
clog
.
Error
(
"paracross.Commit blockHash not match"
,
"isMain"
,
!
types
.
IsPara
(),
"db"
,
hex
.
EncodeToString
(
blockHash
.
Hash
),
"commit tx"
,
hex
.
EncodeToString
(
commitHash
),
"commitHeight"
,
commit
.
Status
.
Height
,
"commitMainHeight"
,
commit
.
Status
.
MainBlockHeight
,
"from"
,
a
.
fromaddr
)
return
nil
,
types
.
ErrBlockHashNoMatch
}
clog
.
Debug
(
"paracross.Commit check input done"
)
// 在完成共识之后来的, 增加 record log, 只记录不修改已经达成的共识
if
commit
.
Status
.
Height
<=
titleStatus
.
Height
{
...
...
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