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
42c9be94
Commit
42c9be94
authored
Jul 08, 2019
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
e30ad65c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
action.go
plugin/dapp/paracross/executor/action.go
+8
-9
db.go
plugin/dapp/paracross/executor/db.go
+1
-2
No files found.
plugin/dapp/paracross/executor/action.go
View file @
42c9be94
...
@@ -353,7 +353,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
...
@@ -353,7 +353,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
// 平行链 (2)commit (5) 将得到一个错误的块
// 平行链 (2)commit (5) 将得到一个错误的块
// 所以有必要做这个检测
// 所以有必要做这个检测
var
dbMainHash
[]
byte
var
dbMainHash
[]
byte
if
!
types
.
IsPara
(){
if
!
types
.
IsPara
()
{
blockHash
,
err
:=
getBlockHash
(
a
.
api
,
commit
.
Status
.
MainBlockHeight
)
blockHash
,
err
:=
getBlockHash
(
a
.
api
,
commit
.
Status
.
MainBlockHeight
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"paracross.Commit getBlockHash"
,
"err"
,
err
,
clog
.
Error
(
"paracross.Commit getBlockHash"
,
"err"
,
err
,
...
@@ -362,10 +362,10 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
...
@@ -362,10 +362,10 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
}
}
dbMainHash
=
blockHash
.
Hash
dbMainHash
=
blockHash
.
Hash
}
else
{
}
else
{
block
,
err
:=
getBlockInfo
(
a
.
api
,
commit
.
Status
.
Height
)
block
,
err
:=
getBlockInfo
(
a
.
api
,
commit
.
Status
.
Height
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"paracross.Commit getBlockInfo"
,
"err"
,
err
,
"height"
,
commit
.
Status
.
Height
,
"from"
,
a
.
fromaddr
)
clog
.
Error
(
"paracross.Commit getBlockInfo"
,
"err"
,
err
,
"height"
,
commit
.
Status
.
Height
,
"from"
,
a
.
fromaddr
)
return
nil
,
err
return
nil
,
err
}
}
dbMainHash
=
block
.
MainHash
dbMainHash
=
block
.
MainHash
...
@@ -527,17 +527,16 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
...
@@ -527,17 +527,16 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
//平行链自共识校验
//平行链自共识校验
selfBlockHash
,
err
:=
getBlockHash
(
a
.
api
,
nodeStatus
.
Height
)
selfBlockHash
,
err
:=
getBlockHash
(
a
.
api
,
nodeStatus
.
Height
)
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"paracross.CommitDone getBlockHash"
,
"err"
,
err
,
"commit tx height"
,
nodeStatus
.
Height
,
"tx"
,
hex
.
EncodeToString
(
a
.
txhash
))
clog
.
Error
(
"paracross.CommitDone getBlockHash"
,
"err"
,
err
,
"commit tx height"
,
nodeStatus
.
Height
,
"tx"
,
hex
.
EncodeToString
(
a
.
txhash
))
return
nil
,
err
return
nil
,
err
}
}
//说明本节点blockhash和共识hash不一致,需要停止本节点执行
//说明本节点blockhash和共识hash不一致,需要停止本节点执行
if
!
bytes
.
Equal
(
selfBlockHash
.
Hash
,
nodeStatus
.
BlockHash
)
{
if
!
bytes
.
Equal
(
selfBlockHash
.
Hash
,
nodeStatus
.
BlockHash
)
{
clog
.
Error
(
"paracross.CommitDone mosthash not match"
,
"height"
,
nodeStatus
.
Height
,
clog
.
Error
(
"paracross.CommitDone mosthash not match"
,
"height"
,
nodeStatus
.
Height
,
"blockHash"
,
hex
.
EncodeToString
(
selfBlockHash
.
Hash
),
"mosthash"
,
hex
.
EncodeToString
(
nodeStatus
.
BlockHash
))
"blockHash"
,
hex
.
EncodeToString
(
selfBlockHash
.
Hash
),
"mosthash"
,
hex
.
EncodeToString
(
nodeStatus
.
BlockHash
))
return
nil
,
pt
.
ErrParaCurHashNotMatch
return
nil
,
pt
.
ErrParaCurHashNotMatch
}
}
//平行连进行奖励分配
//平行连进行奖励分配
rewardReceipt
,
err
:=
a
.
reward
(
nodeStatus
,
stat
)
rewardReceipt
,
err
:=
a
.
reward
(
nodeStatus
,
stat
)
//错误会导致和主链处理的共识结果不一致
//错误会导致和主链处理的共识结果不一致
...
...
plugin/dapp/paracross/executor/db.go
View file @
42c9be94
...
@@ -86,7 +86,7 @@ func getBlockHash(api client.QueueProtocolAPI, height int64) (*types.ReplyHash,
...
@@ -86,7 +86,7 @@ func getBlockHash(api client.QueueProtocolAPI, height int64) (*types.ReplyHash,
func
getBlockInfo
(
api
client
.
QueueProtocolAPI
,
height
int64
)
(
*
types
.
Block
,
error
)
{
func
getBlockInfo
(
api
client
.
QueueProtocolAPI
,
height
int64
)
(
*
types
.
Block
,
error
)
{
blockDetails
,
err
:=
api
.
GetBlocks
(
&
types
.
ReqBlocks
{
Start
:
height
,
End
:
height
})
blockDetails
,
err
:=
api
.
GetBlocks
(
&
types
.
ReqBlocks
{
Start
:
height
,
End
:
height
})
if
err
!=
nil
{
if
err
!=
nil
{
clog
.
Error
(
"paracross.Commit getBlockInfo"
,
"height"
,
height
,
"err"
,
err
.
Error
())
clog
.
Error
(
"paracross.Commit getBlockInfo"
,
"height"
,
height
,
"err"
,
err
.
Error
())
return
nil
,
err
return
nil
,
err
}
}
if
1
!=
int64
(
len
(
blockDetails
.
Items
))
{
if
1
!=
int64
(
len
(
blockDetails
.
Items
))
{
...
@@ -96,7 +96,6 @@ func getBlockInfo(api client.QueueProtocolAPI, height int64) (*types.Block, erro
...
@@ -96,7 +96,6 @@ func getBlockInfo(api client.QueueProtocolAPI, height int64) (*types.Block, erro
return
blockDetails
.
Items
[
0
]
.
Block
,
nil
return
blockDetails
.
Items
[
0
]
.
Block
,
nil
}
}
func
isNotFound
(
err
error
)
bool
{
func
isNotFound
(
err
error
)
bool
{
if
err
!=
nil
&&
(
err
==
dbm
.
ErrNotFoundInDb
||
err
==
types
.
ErrNotFound
)
{
if
err
!=
nil
&&
(
err
==
dbm
.
ErrNotFoundInDb
||
err
==
types
.
ErrNotFound
)
{
return
true
return
true
...
...
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