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
0f12528b
Commit
0f12528b
authored
Feb 18, 2019
by
mdj33
Committed by
vipwzw
Feb 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmt
parent
15f0aa0a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
18 deletions
+17
-18
docker-compose.sh
build/docker-compose.sh
+2
-2
para.go
plugin/consensus/para/para.go
+1
-1
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+13
-14
action.go
plugin/dapp/paracross/executor/action.go
+1
-1
No files found.
build/docker-compose.sh
View file @
0f12528b
...
...
@@ -124,7 +124,7 @@ function start() {
done
miner
"
${
CLI
}
"
# miner "${CLI4}"
# miner "${CLI4}"
block_wait
"
${
CLI
}
"
1
echo
"=========== check genesis hash ========== "
...
...
@@ -318,7 +318,7 @@ function transfer() {
function
base_config
()
{
sync
transfer
"
${
CLI
}
"
# transfer "${CLI4}"
# transfer "${CLI4}"
}
function
dapp_run
()
{
...
...
plugin/consensus/para/para.go
View file @
0f12528b
...
...
@@ -641,7 +641,7 @@ func (client *client) CreateBlock() {
}
plog
.
Info
(
"Parachain process block"
,
"lastSeq"
,
lastSeq
,
"curSeq"
,
currSeq
,
"lastBlockHeight"
,
lastBlock
.
Height
,
"lastBlockSeq"
,
lastBlockSeq
,
"lastBlockHeight"
,
lastBlock
.
Height
,
"lastBlockSeq"
,
lastBlockSeq
,
"currSeqMainHeight"
,
lastSeqMainHeight
,
"currSeqMainHash"
,
common
.
ToHex
(
lastSeqMainHash
),
"lastBlockMainHeight"
,
lastBlock
.
MainHeight
,
"lastBlockMainHash"
,
common
.
ToHex
(
lastBlock
.
MainHash
),
"seqTy"
,
blockOnMain
.
Seq
.
Type
)
...
...
plugin/consensus/para/paracommitmsg.go
View file @
0f12528b
...
...
@@ -34,7 +34,7 @@ type commitMsgClient struct {
}
//获取主链和平行链本身节点的平行链共识状态
type
consensStatus
struct
{
type
consensStatus
struct
{
mainStatus
*
pt
.
ParacrossStatus
selfStatus
*
pt
.
ParacrossStatus
}
...
...
@@ -111,7 +111,7 @@ out:
case
<-
readTick
:
plog
.
Debug
(
"para readTick"
,
"notify"
,
notification
,
"sending"
,
len
(
sendingMsgs
),
"finishHeight"
,
finishHeight
,
"txIsNil"
,
client
.
currentTx
==
nil
,
"sync"
,
isSync
)
"finishHeight"
,
finishHeight
,
"txIsNil"
,
client
.
currentTx
==
nil
,
"sync"
,
isSync
)
if
notification
!=
nil
&&
finishHeight
<
notification
[
1
]
&&
client
.
currentTx
==
nil
&&
isSync
{
count
:=
notification
[
1
]
-
finishHeight
...
...
@@ -148,10 +148,10 @@ out:
mainConsensHeight
:=
rsp
.
mainStatus
.
Height
plog
.
Info
(
"para consensus rcv"
,
"notify"
,
notification
,
"sending"
,
len
(
sendingMsgs
),
"mainHeigt"
,
rsp
.
mainStatus
.
Height
,
"mainlockhash"
,
common
.
ToHex
(
rsp
.
mainStatus
.
BlockHash
),
"selfHeight"
,
rsp
.
selfStatus
.
Height
,
"selfHash"
,
common
.
ToHex
(
rsp
.
selfStatus
.
BlockHash
),
"sync"
,
isSync
)
"selfHeight"
,
rsp
.
selfStatus
.
Height
,
"selfHash"
,
common
.
ToHex
(
rsp
.
selfStatus
.
BlockHash
),
"sync"
,
isSync
)
//所有节点还没有共识场景或新节点或重启节点catchingUp场景,要等到收到区块高度大于主链共识高度时候发送,在catchingup时候本身共识高度和块高度一起增长
if
selfConsensusHeight
==
-
1
||
(
notification
!=
nil
&&
notification
[
1
]
>
mainConsensHeight
)
{
if
selfConsensusHeight
==
-
1
||
(
notification
!=
nil
&&
notification
[
1
]
>
mainConsensHeight
)
{
isSync
=
true
}
...
...
@@ -160,7 +160,6 @@ out:
finishHeight
=
selfConsensusHeight
}
//系统每次重启都有检查一次共识,如果共识高度落后于系统起来后完成的第一个高度或最小高度,说明可能有共识空洞,需要把从当前共识高度到完成的
//最大高度重发一遍,直到确认收到,发过的最小到最大高度也要重发是因为之前空洞原因共识不连续,即便满足2/3节点也不会增长,需要重发来触发commit
//此处也整合了当前consensus height=-1 场景
...
...
@@ -178,7 +177,7 @@ out:
//理论上来说selfConsensusHeight只能小于等于mainConsensusHeihgt,因为在主链先共识之后才会同步到平行链
//此处主链共识高度应该会开始追赶平行链高度,在这种异常场景下,可能会有重复发送
if
mainConsensHeight
<
selfConsensusHeight
{
plog
.
Info
(
"para consensus reset"
,
"finishHeight"
,
finishHeight
,
"mainHeight"
,
mainConsensHeight
,
"selfHeight"
,
selfConsensusHeight
)
plog
.
Info
(
"para consensus reset"
,
"finishHeight"
,
finishHeight
,
"mainHeight"
,
mainConsensHeight
,
"selfHeight"
,
selfConsensusHeight
)
finishHeight
=
mainConsensHeight
sendingMsgs
=
nil
client
.
currentTx
=
nil
...
...
@@ -494,9 +493,9 @@ out:
//从本地查询共识高度
ret
,
err
:=
client
.
paraClient
.
GetAPI
()
.
QueryChain
(
&
types
.
ChainExecutor
{
Driver
:
"paracross"
,
FuncName
:
"GetTitle"
,
Param
:
types
.
Encode
(
&
types
.
ReqString
{
Data
:
types
.
GetTitle
()}),
Driver
:
"paracross"
,
FuncName
:
"GetTitle"
,
Param
:
types
.
Encode
(
&
types
.
ReqString
{
Data
:
types
.
GetTitle
()}),
})
if
err
!=
nil
{
plog
.
Error
(
"getConsensusHeight "
,
"err"
,
err
.
Error
())
...
...
@@ -510,10 +509,10 @@ out:
status
.
selfStatus
=
resp
//获取主链共识高度
reply
,
err
:=
client
.
paraClient
.
grpcClient
.
QueryChain
(
context
.
Background
(),
&
types
.
ChainExecutor
{
Driver
:
"paracross"
,
FuncName
:
"GetTitle"
,
Param
:
types
.
Encode
(
&
types
.
ReqString
{
Data
:
types
.
GetTitle
()}),
reply
,
err
:=
client
.
paraClient
.
grpcClient
.
QueryChain
(
context
.
Background
(),
&
types
.
ChainExecutor
{
Driver
:
"paracross"
,
FuncName
:
"GetTitle"
,
Param
:
types
.
Encode
(
&
types
.
ReqString
{
Data
:
types
.
GetTitle
()}),
})
if
err
!=
nil
{
plog
.
Error
(
"getMainConsensusHeight"
,
"err"
,
err
.
Error
())
...
...
@@ -525,7 +524,7 @@ out:
}
var
result
pt
.
ParacrossStatus
err
=
types
.
Decode
(
reply
.
Msg
,
&
result
)
if
err
!=
nil
{
if
err
!=
nil
{
plog
.
Error
(
"getMainConsensusHeight decode"
,
"err"
,
err
.
Error
())
continue
}
...
...
plugin/dapp/paracross/executor/action.go
View file @
0f12528b
...
...
@@ -254,7 +254,7 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
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
)
"commitMainHeight"
,
commit
.
Status
.
MainBlockHeight
,
"from"
,
a
.
fromaddr
)
return
nil
,
types
.
ErrBlockHashNoMatch
}
}
...
...
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