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
721cfedf
Commit
721cfedf
authored
Jul 05, 2019
by
mdj33
Committed by
vipwzw
Jul 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cut commit status parameter
parent
5be6fba4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
61 additions
and
28 deletions
+61
-28
para.go
plugin/consensus/para/para.go
+5
-2
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+6
-4
action.go
plugin/dapp/paracross/executor/action.go
+0
-0
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+10
-8
filtertxs.go
plugin/dapp/paracross/executor/filtertxs.go
+1
-1
paracross.go
plugin/dapp/paracross/executor/paracross.go
+0
-3
query.go
plugin/dapp/paracross/executor/query.go
+0
-4
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+1
-1
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+3
-5
paracross.go
plugin/dapp/paracross/types/paracross.go
+35
-0
No files found.
plugin/consensus/para/para.go
View file @
721cfedf
...
...
@@ -687,12 +687,15 @@ func (client *client) addMinerTx(preStateHash []byte, block *types.Block, main *
status
:=
&
pt
.
ParacrossNodeStatus
{
Title
:
types
.
GetTitle
(),
Height
:
block
.
Height
,
PreBlockHash
:
block
.
ParentHash
,
PreStateHash
:
preStateHash
,
MainBlockHash
:
main
.
Seq
.
Hash
,
MainBlockHeight
:
main
.
Detail
.
Block
.
Height
,
}
if
!
paracross
.
IsParaForkHeight
(
status
.
MainBlockHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
status
.
PreBlockHash
=
block
.
ParentHash
status
.
PreStateHash
=
preStateHash
}
tx
,
err
:=
pt
.
CreateRawMinerTx
(
&
pt
.
ParacrossMinerAction
{
Status
:
status
,
IsSelfConsensus
:
isParaSelfConsensusForked
(
status
.
MainBlockHeight
),
...
...
plugin/consensus/para/paracommitmsg.go
View file @
721cfedf
...
...
@@ -445,7 +445,6 @@ func (client *commitMsgClient) getNodeStatus(start, end int64) ([]*pt.ParacrossN
return
nil
,
errors
.
New
(
"paracommitmsg wrong block result"
)
}
nodeList
[
block
.
Block
.
Height
]
.
BlockHash
=
block
.
Block
.
Hash
()
nodeList
[
block
.
Block
.
Height
]
.
StateHash
=
block
.
Block
.
StateHash
}
var
needSentTxs
uint32
...
...
@@ -462,6 +461,11 @@ func (client *commitMsgClient) getNodeStatus(start, end int64) ([]*pt.ParacrossN
return
nil
,
nil
}
//clear flag
for
_
,
v
:=
range
ret
{
v
.
NonCommitTxCounts
=
0
}
return
ret
,
nil
}
...
...
@@ -479,10 +483,8 @@ func (client *commitMsgClient) getGenesisNodeStatus() (*pt.ParacrossNodeStatus,
}
status
.
Title
=
types
.
GetTitle
()
status
.
Height
=
block
.
Height
status
.
PreBlockHash
=
zeroHash
[
:
]
status
.
BlockHash
=
block
.
Hash
()
status
.
PreStateHash
=
zeroHash
[
:
]
status
.
StateHash
=
block
.
StateHash
return
&
status
,
nil
}
...
...
plugin/dapp/paracross/executor/action.go
View file @
721cfedf
This diff is collapsed.
Click to expand it.
plugin/dapp/paracross/executor/exec_local.go
View file @
721cfedf
...
...
@@ -217,7 +217,6 @@ func setMinerTxResultFork(status *pt.ParacrossNodeStatus, txs []*types.Transacti
}
}
status
.
TxCounts
=
uint32
(
len
(
curTxHashs
))
//有tx且全部是user.p.x.paracross的commit tx时候设为0
status
.
NonCommitTxCounts
=
1
if
len
(
curTxHashs
)
!=
0
&&
len
(
curTxHashs
)
==
len
(
isCommitTx
)
{
...
...
@@ -227,12 +226,15 @@ func setMinerTxResultFork(status *pt.ParacrossNodeStatus, txs []*types.Transacti
//主链自己过滤平行链tx, 对平行链执行失败的tx主链无法识别,主链和平行链需要获取相同的最初的tx map
//全部平行链tx结果
status
.
TxResult
=
[]
byte
(
hex
.
EncodeToString
(
util
.
CalcBitMap
(
curTxHashs
,
curTxHashs
,
receipts
)))
//跨链tx结果
status
.
CrossTxResult
=
[]
byte
(
hex
.
EncodeToString
(
util
.
CalcBitMap
(
crossTxHashs
,
curTxHashs
,
receipts
)))
status
.
TxHashs
=
[][]
byte
{
CalcTxHashsHash
(
curTxHashs
)}
status
.
CrossTxHashs
=
[][]
byte
{
CalcTxHashsHash
(
crossTxHashs
)}
status
.
TxResult
=
[]
byte
(
hex
.
EncodeToString
(
util
.
CalcSingleBitMap
(
curTxHashs
,
receipts
)))
//ForkLoopCheckCommitTxDone 后只保留全部txreseult 结果
if
!
pt
.
IsParaForkHeight
(
status
.
MainBlockHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
//跨链tx结果
status
.
CrossTxResult
=
[]
byte
(
hex
.
EncodeToString
(
util
.
CalcBitMap
(
crossTxHashs
,
curTxHashs
,
receipts
)))
status
.
TxHashs
=
[][]
byte
{
CalcTxHashsHash
(
curTxHashs
)}
status
.
CrossTxHashs
=
[][]
byte
{
CalcTxHashsHash
(
crossTxHashs
)}
}
return
nil
}
...
...
@@ -246,7 +248,7 @@ func (e *Paracross) ExecLocal_Miner(payload *pt.ParacrossMinerAction, tx *types.
var
set
types
.
LocalDBSet
txs
:=
e
.
GetTxs
()
forkHeight
:=
g
etDappForkHeight
(
pt
.
ForkCommitTx
)
forkHeight
:=
pt
.
G
etDappForkHeight
(
pt
.
ForkCommitTx
)
//removed the 0 vote tx
if
payload
.
Status
.
MainBlockHeight
>=
forkHeight
{
...
...
plugin/dapp/paracross/executor/filtertxs.go
View file @
721cfedf
...
...
@@ -75,7 +75,7 @@ func filterParaTxGroup(title string, tx *types.Transaction, main *types.BlockDet
//FilterTxsForPara include some main tx in tx group before ForkParacrossCommitTx
func
FilterTxsForPara
(
title
string
,
main
*
types
.
BlockDetail
)
[]
*
types
.
Transaction
{
var
txs
[]
*
types
.
Transaction
forkHeight
:=
g
etDappForkHeight
(
pt
.
ForkCommitTx
)
forkHeight
:=
pt
.
G
etDappForkHeight
(
pt
.
ForkCommitTx
)
for
i
:=
0
;
i
<
len
(
main
.
Block
.
Txs
);
i
++
{
tx
:=
main
.
Block
.
Txs
[
i
]
if
types
.
IsSpecificParaExecName
(
title
,
string
(
tx
.
Execer
))
{
...
...
plugin/dapp/paracross/executor/paracross.go
View file @
721cfedf
...
...
@@ -97,9 +97,6 @@ func (c *Paracross) saveLocalParaTxsFork(commitDone *pt.ReceiptParacrossDone, is
Height
:
commitDone
.
Height
,
BlockHash
:
commitDone
.
BlockHash
,
TxResult
:
commitDone
.
TxResult
,
TxHashs
:
commitDone
.
TxHashs
,
CrossTxResult
:
commitDone
.
CrossTxResult
,
CrossTxHashs
:
commitDone
.
CrossTxHashs
,
}
crossTxHashs
,
crossTxResult
,
err
:=
getCrossTxHashs
(
c
.
GetAPI
(),
status
)
...
...
plugin/dapp/paracross/executor/query.go
View file @
721cfedf
...
...
@@ -226,8 +226,6 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) {
MostSameCommit
:
st
.
MostSameCommit
,
Title
:
st
.
Title
,
Height
:
st
.
Height
,
StateHash
:
common
.
ToHex
(
st
.
StateHash
),
TxCounts
:
st
.
TxCounts
,
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
}
...
...
@@ -313,8 +311,6 @@ func loadLocalTitle(db dbm.KV, title string, height int64) (types.Message, error
MostSameCommit
:
st
.
MostSameCommit
,
Title
:
st
.
Title
,
Height
:
st
.
Height
,
StateHash
:
common
.
ToHex
(
st
.
StateHash
),
TxCounts
:
st
.
TxCounts
,
TxResult
:
hex
.
EncodeToString
(
st
.
TxResult
),
},
nil
}
...
...
plugin/dapp/paracross/executor/superaccount.go
View file @
721cfedf
...
...
@@ -612,7 +612,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
}
receipt
=
mergeReceipt
(
receipt
,
r
)
if
a
.
exec
.
GetMainHeight
()
>
g
etDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
if
a
.
exec
.
GetMainHeight
()
>
pt
.
G
etDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
//node quit后,如果committx满足2/3目标,自动触发commitDone
r
,
err
=
a
.
loopCommitTxDone
(
config
.
Title
)
if
err
!=
nil
{
...
...
plugin/dapp/paracross/proto/paracross.proto
View file @
721cfedf
...
...
@@ -16,11 +16,9 @@ message ParacrossStatusDetails {
//记录不同blockHash的详细数据
message
ParacrossStatusBlockDetails
{
repeated
bytes
blockHashs
=
1
;
repeated
bytes
stateHashs
=
2
;
repeated
bytes
txResults
=
3
;
repeated
bytes
txHashs
=
4
;
repeated
bytes
crossTxResults
=
5
;
repeated
bytes
crossTxHashs
=
6
;
repeated
bytes
txResults
=
2
;
}
message
ParacrossHeightStatus
{
...
...
plugin/dapp/paracross/types/paracross.go
View file @
721cfedf
...
...
@@ -308,3 +308,38 @@ func (p ParacrossType) CreateRawTransferTx(action string, param json.RawMessage)
return
tx
,
nil
}
func
GetDappForkHeight
(
forkKey
string
)
int64
{
var
forkHeight
int64
if
types
.
IsPara
()
{
key
:=
forkKey
switch
forkKey
{
case
ForkCommitTx
:
key
=
MainForkParacrossCommitTx
case
ForkLoopCheckCommitTxDone
:
key
=
MainLoopCheckCommitTxDoneForkHeight
}
forkHeight
=
types
.
Conf
(
"config.consensus.sub.para"
)
.
GInt
(
key
)
if
forkHeight
<=
0
{
forkHeight
=
types
.
MaxHeight
}
}
else
{
forkHeight
=
types
.
GetDappFork
(
ParaX
,
forkKey
)
// CI特殊处理,主链是local,fork都是0,平行链有些配置项需要设置为非0,不然获取到的高度为MaxHeight
if
types
.
IsLocal
()
{
switch
forkKey
{
case
ForkCommitTx
:
forkHeight
=
10
case
ForkLoopCheckCommitTxDone
:
forkHeight
=
60
}
}
}
return
forkHeight
}
func
IsParaForkHeight
(
height
int64
,
forkKey
string
)
bool
{
return
height
>=
GetDappForkHeight
(
forkKey
)
}
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