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
3a997b66
Commit
3a997b66
authored
Mar 28, 2019
by
mdj33
Committed by
vipwzw
Apr 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rmv parachain check most hash as not needed
parent
88c2d368
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
51 deletions
+13
-51
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+7
-1
docker-compose-paracross.yml
plugin/dapp/paracross/cmd/build/docker-compose-paracross.yml
+2
-2
action.go
plugin/dapp/paracross/executor/action.go
+0
-25
kv.go
plugin/dapp/paracross/executor/kv.go
+0
-6
query.go
plugin/dapp/paracross/executor/query.go
+4
-17
No files found.
plugin/consensus/para/paracommitmsg.go
View file @
3a997b66
...
...
@@ -155,7 +155,7 @@ out:
case
rsp
:=
<-
consensusCh
:
consensHeight
:=
rsp
.
Height
plog
.
Info
(
"para consensus rcv"
,
"notify"
,
notification
,
"sending"
,
len
(
sendingMsgs
),
"consensHeigt"
,
rsp
.
Height
,
"
consensBlockHash"
,
common
.
ToHex
(
rsp
.
BlockHash
),
"sync"
,
isSync
)
"consensHeigt"
,
rsp
.
Height
,
"
finished"
,
finishHeight
,
"sync"
,
isSync
,
"consensBlockHash"
,
common
.
ToHex
(
rsp
.
BlockHash
)
)
if
notification
==
nil
||
isRollback
{
continue
...
...
@@ -166,6 +166,11 @@ out:
isSync
=
true
}
// 共识高度追赶上完成高度之后再发,不然分叉节点继续发浪费手续费
if
finishHeight
>
consensHeight
{
isSync
=
false
}
//未共识过的小于当前共识高度的区块,可以不参与共识, 如果是新节点,一直等到同步的区块达到了共识高度,才设置同步参与共识
//在某些特殊场景下,比如平行链连接的主链节点分叉后又恢复,主链的共识高度低于分叉高度时候,主链上形成共识空洞,需要从共识高度重新发送而不是分叉高度
//共识高度和分叉高度不一致其中一个原因是共识交易组里面某个高度分叉了,分叉的主链节点执行成功,而其他主链节点执行失败,共识高度停留在交易组最小高度-1
...
...
@@ -186,6 +191,7 @@ out:
finishHeight
=
consensHeight
sendingMsgs
=
nil
client
.
currentTx
=
nil
isSync
=
true
}
case
key
,
ok
:=
<-
priKeyCh
:
...
...
plugin/dapp/paracross/cmd/build/docker-compose-paracross.yml
View file @
3a997b66
...
...
@@ -33,5 +33,5 @@ services:
-
chain30
volumes
:
-
./nginx.conf:/etc/nginx/nginx.conf
expose
:
-
"
8803"
ports
:
-
"
880
2:880
3"
plugin/dapp/paracross/executor/action.go
View file @
3a997b66
...
...
@@ -361,25 +361,6 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
}
clog
.
Info
(
"paracross.Commit commit ----pass"
,
"most"
,
most
,
"mostHash"
,
hex
.
EncodeToString
([]
byte
(
mostHash
)))
// parallel chain get self blockhash and compare with commit done result, if not match, just log and return
if
types
.
IsPara
()
{
saveTitleHeight
(
a
.
db
,
calcTitleHeightKey
(
commit
.
Status
.
Title
,
commit
.
Status
.
Height
),
stat
)
blockHash
,
err
:=
getBlockHash
(
a
.
api
,
stat
.
Height
)
if
err
!=
nil
{
clog
.
Error
(
"paracross.Commit para getBlockHash local"
,
"err"
,
err
.
Error
(),
"commitheight"
,
commit
.
Status
.
Height
,
"commitHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
BlockHash
),
"mainHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
MainBlockHash
),
"mainHeight"
,
commit
.
Status
.
MainBlockHeight
)
return
receipt
,
nil
}
if
!
bytes
.
Equal
(
blockHash
.
Hash
,
[]
byte
(
mostHash
))
{
clog
.
Error
(
"paracross.Commit para blockHash not match"
,
"selfBlockHash"
,
hex
.
EncodeToString
(
blockHash
.
Hash
),
"mostHash"
,
hex
.
EncodeToString
([]
byte
(
mostHash
)),
"commitHeight"
,
commit
.
Status
.
Height
,
"commitMainHash"
,
hex
.
EncodeToString
(
commit
.
Status
.
MainBlockHash
),
"commitMainHeight"
,
commit
.
Status
.
MainBlockHeight
)
return
receipt
,
nil
}
}
stat
.
Status
=
pt
.
ParacrossStatusCommitDone
receiptDone
:=
makeDoneReceipt
(
a
.
fromaddr
,
commit
,
stat
,
int32
(
most
),
int32
(
commitCount
),
int32
(
len
(
nodes
)))
receipt
.
KV
=
append
(
receipt
.
KV
,
receiptDone
.
KV
...
)
...
...
@@ -391,12 +372,6 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
titleStatus
.
BlockHash
=
commit
.
Status
.
BlockHash
saveTitle
(
a
.
db
,
calcTitleKey
(
commit
.
Status
.
Title
),
titleStatus
)
if
types
.
IsDappFork
(
a
.
exec
.
GetMainHeight
(),
pt
.
ParaX
,
pt
.
ForkCommitTx
)
{
key
:=
calcTitleHashKey
(
commit
.
Status
.
Title
,
hex
.
EncodeToString
(
commit
.
Status
.
MainBlockHash
))
saveTitle
(
a
.
db
,
key
,
titleStatus
)
receipt
.
KV
=
append
(
receipt
.
KV
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
titleStatus
)})
}
clog
.
Info
(
"paracross.Commit commit done"
,
"height"
,
commit
.
Status
.
Height
,
"cross tx count"
,
len
(
commit
.
Status
.
CrossTxHashs
),
"statusBlockHash"
,
hex
.
EncodeToString
(
titleStatus
.
BlockHash
))
...
...
plugin/dapp/paracross/executor/kv.go
View file @
3a997b66
...
...
@@ -13,7 +13,6 @@ import (
var
(
title
string
titleHeight
string
titleHash
string
managerConfigNodes
string
//manager 合约配置的nodes
paraConfigNodes
string
//平行链自组织配置的nodes,最初是从manager同步过来
paraConfigNodeAddr
string
//平行链配置节点账户
...
...
@@ -28,7 +27,6 @@ var (
func
setPrefix
()
{
title
=
"mavl-paracross-title-"
titleHeight
=
"mavl-paracross-titleHeight-"
titleHash
=
"mavl-paracross-titleHash-"
managerConfigNodes
=
"paracross-nodes-"
paraConfigNodes
=
"mavl-paracross-nodes-title-"
paraConfigNodeAddr
=
"mavl-paracross-nodes-titleAddr-"
...
...
@@ -50,10 +48,6 @@ func calcTitleHeightKey(title string, height int64) []byte {
return
[]
byte
(
fmt
.
Sprintf
(
titleHeight
+
"%s-%d"
,
title
,
height
))
}
func
calcTitleHashKey
(
title
string
,
blockHash
string
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
titleHash
+
"%s-%s"
,
title
,
blockHash
))
}
func
calcLocalHeightKey
(
title
string
,
height
int64
)
[]
byte
{
return
[]
byte
(
fmt
.
Sprintf
(
localTitleHeight
+
"%s-%d"
,
title
,
height
))
}
...
...
plugin/dapp/paracross/executor/query.go
View file @
3a997b66
...
...
@@ -31,16 +31,11 @@ func (p *Paracross) Query_GetTitleByHash(in *pt.ReqParacrossTitleHash) (types.Me
return
nil
,
types
.
ErrInvalidParam
}
if
!
types
.
IsDappFork
(
p
.
GetMainHeight
(),
pt
.
ParaX
,
pt
.
ForkCommitTx
)
{
block
,
err
:=
p
.
GetAPI
()
.
GetBlockOverview
(
&
types
.
ReqHash
{
Hash
:
in
.
BlockHash
})
if
err
!=
nil
||
block
==
nil
{
return
nil
,
types
.
ErrHashNotExist
}
return
p
.
paracrossGetHeight
(
in
.
GetTitle
())
block
,
err
:=
p
.
GetAPI
()
.
GetBlockOverview
(
&
types
.
ReqHash
{
Hash
:
in
.
BlockHash
})
if
err
!=
nil
||
block
==
nil
{
return
nil
,
types
.
ErrHashNotExist
}
return
p
.
paracrossGetHeightByHash
(
in
)
return
p
.
paracrossGetHeight
(
in
.
GetTitle
())
}
//Query_GetNodeGroup get node group addrs
...
...
@@ -145,14 +140,6 @@ func (p *Paracross) paracrossGetHeight(title string) (types.Message, error) {
return
ret
,
nil
}
func
(
p
*
Paracross
)
paracrossGetHeightByHash
(
in
*
pt
.
ReqParacrossTitleHash
)
(
types
.
Message
,
error
)
{
ret
,
err
:=
getTitle
(
p
.
GetStateDB
(),
calcTitleHashKey
(
in
.
GetTitle
(),
hex
.
EncodeToString
(
in
.
GetBlockHash
())))
if
err
!=
nil
{
return
nil
,
errors
.
Cause
(
err
)
}
return
ret
,
nil
}
func
(
p
*
Paracross
)
paracrossListTitles
()
(
types
.
Message
,
error
)
{
return
listLocalTitles
(
p
.
GetLocalDB
())
}
...
...
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