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
7bc33343
Commit
7bc33343
authored
May 24, 2019
by
mdj33
Committed by
vipwzw
May 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delay send commit tx when block has all user.p.x.paracross commit tx
parent
a1c5bef5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
7 deletions
+44
-7
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+14
-0
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+30
-7
No files found.
plugin/consensus/para/paracommitmsg.go
View file @
7bc33343
...
...
@@ -130,6 +130,9 @@ out:
plog
.
Error
(
"para commit msg read tick"
,
"err"
,
err
.
Error
())
continue
}
if
len
(
status
)
==
0
{
continue
}
signTx
,
count
,
err
:=
client
.
calcCommitMsgTxs
(
status
)
if
err
!=
nil
||
signTx
==
nil
{
...
...
@@ -426,9 +429,20 @@ func (client *commitMsgClient) getNodeStatus(start, end int64) ([]*pt.ParacrossN
nodeList
[
block
.
Block
.
Height
]
.
StateHash
=
block
.
Block
.
StateHash
}
var
needSentTxs
uint32
for
i
:=
0
;
i
<
int
(
count
);
i
++
{
ret
=
append
(
ret
,
nodeList
[
req
.
Start
+
int64
(
i
)])
needSentTxs
+=
nodeList
[
req
.
Start
+
int64
(
i
)]
.
TxCounts
}
//1.如果是只有commit tx的空块,推迟发送,直到等到一个完全没有commit tx的空块或者其他tx的块
//2,如果20个块都是 commit tx的空块,20个块打包一次发送,尽量减少commit tx造成的空块
//3,如果形如xxoxx的块排列,x代表commit空块,o代表实际的块,即只要不全部是commit块,也要全部打包一起发出去
//如果=0 意味着全部是paracross commit tx,延迟发送
if
needSentTxs
==
0
&&
count
<
types
.
TxGroupMaxCount
{
plog
.
Info
(
"para commitmsg getNodeStatus all self consensus commit tx,send delay"
,
"start"
,
start
,
"end"
,
end
)
return
nil
,
nil
}
return
ret
,
nil
}
...
...
plugin/dapp/paracross/executor/exec_local.go
View file @
7bc33343
...
...
@@ -164,23 +164,43 @@ func setMinerTxResult(payload *pt.ParacrossMinerAction, txs []*types.Transaction
return
nil
}
func
setMinerTxResultFork
(
payload
*
pt
.
ParacrossMinerAction
,
txs
[]
*
types
.
Transaction
,
receipts
[]
*
types
.
ReceiptData
)
{
func
setMinerTxResultFork
(
status
*
pt
.
ParacrossNodeStatus
,
txs
[]
*
types
.
Transaction
,
receipts
[]
*
types
.
ReceiptData
)
error
{
isCommitTx
:=
make
(
map
[
string
]
bool
)
var
curTxHashs
[][]
byte
for
_
,
tx
:=
range
txs
{
hash
:=
tx
.
Hash
()
curTxHashs
=
append
(
curTxHashs
,
hash
)
if
types
.
IsMyParaExecName
(
string
(
tx
.
Execer
))
&&
bytes
.
HasSuffix
(
tx
.
Execer
,
[]
byte
(
pt
.
ParaX
))
{
var
payload
pt
.
ParacrossAction
err
:=
types
.
Decode
(
tx
.
Payload
,
&
payload
)
if
err
!=
nil
{
clog
.
Error
(
"setMinerTxResultFork"
,
"txHash"
,
common
.
ToHex
(
hash
))
return
err
}
if
payload
.
Ty
==
pt
.
ParacrossActionCommit
{
isCommitTx
[
string
(
hash
)]
=
true
}
}
}
baseCrossTxHashs
:=
FilterParaCrossTxHashes
(
types
.
GetTitle
(),
txs
)
//有tx且全部是user.p.x.paracross的commit tx时候设为0
status
.
TxCounts
=
1
if
len
(
curTxHashs
)
!=
0
&&
len
(
curTxHashs
)
==
len
(
isCommitTx
)
{
status
.
TxCounts
=
0
}
crossTxHashs
:=
FilterParaCrossTxHashes
(
types
.
GetTitle
(),
txs
)
//主链自己过滤平行链tx, 对平行链执行失败的tx主链无法识别,主链和平行链需要获取相同的最初的tx map
//全部平行链tx结果
payload
.
S
tatus
.
TxResult
=
util
.
CalcBitMap
(
curTxHashs
,
curTxHashs
,
receipts
)
s
tatus
.
TxResult
=
util
.
CalcBitMap
(
curTxHashs
,
curTxHashs
,
receipts
)
//跨链tx结果
payload
.
Status
.
CrossTxResult
=
util
.
CalcBitMap
(
baseCrossTxHashs
,
curTxHashs
,
receipts
)
status
.
CrossTxResult
=
util
.
CalcBitMap
(
crossTxHashs
,
curTxHashs
,
receipts
)
status
.
TxHashs
=
[][]
byte
{
CalcTxHashsHash
(
curTxHashs
)}
status
.
CrossTxHashs
=
[][]
byte
{
CalcTxHashsHash
(
crossTxHashs
)}
payload
.
Status
.
TxHashs
=
[][]
byte
{
CalcTxHashsHash
(
curTxHashs
)}
payload
.
Status
.
CrossTxHashs
=
[][]
byte
{
CalcTxHashsHash
(
baseCrossTxHashs
)}
return
nil
}
//ExecLocal_Miner miner tx local db process
...
...
@@ -196,7 +216,10 @@ func (e *Paracross) ExecLocal_Miner(payload *pt.ParacrossMinerAction, tx *types.
//removed the 0 vote tx
if
payload
.
Status
.
MainBlockHeight
>=
forkHeight
{
setMinerTxResultFork
(
payload
,
txs
[
1
:
],
e
.
GetReceipt
()[
1
:
])
err
:=
setMinerTxResultFork
(
payload
.
Status
,
txs
[
1
:
],
e
.
GetReceipt
()[
1
:
])
if
err
!=
nil
{
return
nil
,
err
}
}
else
{
err
:=
setMinerTxResult
(
payload
,
txs
[
1
:
],
e
.
GetReceipt
()[
1
:
])
if
err
!=
nil
{
...
...
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