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
cedd7c81
Commit
cedd7c81
authored
Jun 29, 2019
by
mdj33
Committed by
vipwzw
Jul 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix receipt
parent
a077e677
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
action.go
plugin/dapp/paracross/executor/action.go
+18
-9
No files found.
plugin/dapp/paracross/executor/action.go
View file @
cedd7c81
...
@@ -285,6 +285,10 @@ func getDappForkHeight(forkKey string) int64 {
...
@@ -285,6 +285,10 @@ func getDappForkHeight(forkKey string) int64 {
return
forkHeight
return
forkHeight
}
}
func
isParaForkHeight
(
height
int64
,
forkKey
string
)
bool
{
return
height
>=
getDappForkHeight
(
forkKey
)
}
func
getConfigNodes
(
db
dbm
.
KV
,
title
string
)
(
map
[
string
]
struct
{},
[]
byte
,
error
)
{
func
getConfigNodes
(
db
dbm
.
KV
,
title
string
)
(
map
[
string
]
struct
{},
[]
byte
,
error
)
{
key
:=
calcParaNodeGroupAddrsKey
(
title
)
key
:=
calcParaNodeGroupAddrsKey
(
title
)
nodes
,
_
,
err
:=
getNodes
(
db
,
key
)
nodes
,
_
,
err
:=
getNodes
(
db
,
key
)
...
@@ -425,13 +429,13 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
...
@@ -425,13 +429,13 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
BlockHash
:
[][]
byte
{
commit
.
Status
.
BlockHash
},
BlockHash
:
[][]
byte
{
commit
.
Status
.
BlockHash
},
},
},
}
}
if
a
.
exec
.
GetMainHeight
()
>=
getDappForkHeight
(
pt
.
ForkCommitTx
)
{
if
isParaForkHeight
(
a
.
exec
.
GetMainHeight
(),
pt
.
ForkCommitTx
)
{
stat
.
MainHeight
=
commit
.
Status
.
MainBlockHeight
stat
.
MainHeight
=
commit
.
Status
.
MainBlockHeight
stat
.
MainHash
=
commit
.
Status
.
MainBlockHash
stat
.
MainHash
=
commit
.
Status
.
MainBlockHash
}
}
//用commit.MainBlockHeight 判断更准确,如果用a.exec.MainHeight也可以,但是可能收到MainHeight之前的高度共识tx,
//用commit.MainBlockHeight 判断更准确,如果用a.exec.MainHeight也可以,但是可能收到MainHeight之前的高度共识tx,
// 后面loopCommitTxDone时候也是用当前共识高度大于分叉高度判断
// 后面loopCommitTxDone时候也是用当前共识高度大于分叉高度判断
if
commit
.
Status
.
MainBlockHeight
>=
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
if
isParaForkHeight
(
commit
.
Status
.
MainBlockHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
stat
.
BlockDetails
=
&
pt
.
ParacrossStatusBlockDetails
{}
stat
.
BlockDetails
=
&
pt
.
ParacrossStatusBlockDetails
{}
updateCommitBlockHashs
(
stat
,
commit
.
Status
)
updateCommitBlockHashs
(
stat
,
commit
.
Status
)
}
}
...
@@ -448,13 +452,13 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
...
@@ -448,13 +452,13 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
found
,
index
:=
hasCommited
(
stat
.
Details
.
Addrs
,
a
.
fromaddr
)
found
,
index
:=
hasCommited
(
stat
.
Details
.
Addrs
,
a
.
fromaddr
)
if
found
{
if
found
{
stat
.
Details
.
BlockHash
[
index
]
=
commit
.
Status
.
BlockHash
stat
.
Details
.
BlockHash
[
index
]
=
commit
.
Status
.
BlockHash
if
commit
.
Status
.
MainBlockHeight
>=
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
if
isParaForkHeight
(
commit
.
Status
.
MainBlockHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
updateCommitBlockHashs
(
stat
,
commit
.
Status
)
updateCommitBlockHashs
(
stat
,
commit
.
Status
)
}
}
}
else
{
}
else
{
stat
.
Details
.
Addrs
=
append
(
stat
.
Details
.
Addrs
,
a
.
fromaddr
)
stat
.
Details
.
Addrs
=
append
(
stat
.
Details
.
Addrs
,
a
.
fromaddr
)
stat
.
Details
.
BlockHash
=
append
(
stat
.
Details
.
BlockHash
,
commit
.
Status
.
BlockHash
)
stat
.
Details
.
BlockHash
=
append
(
stat
.
Details
.
BlockHash
,
commit
.
Status
.
BlockHash
)
if
commit
.
Status
.
MainBlockHeight
>=
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
if
isParaForkHeight
(
commit
.
Status
.
MainBlockHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
updateCommitBlockHashs
(
stat
,
commit
.
Status
)
updateCommitBlockHashs
(
stat
,
commit
.
Status
)
}
}
}
}
...
@@ -466,6 +470,11 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
...
@@ -466,6 +470,11 @@ func (a *action) Commit(commit *pt.ParacrossCommitAction) (*types.Receipt, error
updateCommitAddrs
(
stat
,
nodes
)
updateCommitAddrs
(
stat
,
nodes
)
}
}
saveTitleHeight
(
a
.
db
,
calcTitleHeightKey
(
stat
.
Title
,
stat
.
Height
),
stat
)
saveTitleHeight
(
a
.
db
,
calcTitleHeightKey
(
stat
.
Title
,
stat
.
Height
),
stat
)
//fork之前记录的stat 没有根据nodes更新而更新
if
isParaForkHeight
(
stat
.
MainHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
r
:=
makeCommitStatReceipt
(
stat
)
receipt
=
mergeReceipt
(
receipt
,
r
)
}
if
commit
.
Status
.
Height
>
titleStatus
.
Height
+
1
{
if
commit
.
Status
.
Height
>
titleStatus
.
Height
+
1
{
saveTitleHeight
(
a
.
db
,
calcTitleHeightKey
(
commit
.
Status
.
Title
,
commit
.
Status
.
Height
),
stat
)
saveTitleHeight
(
a
.
db
,
calcTitleHeightKey
(
commit
.
Status
.
Title
,
commit
.
Status
.
Height
),
stat
)
...
@@ -506,7 +515,7 @@ func (a *action) commitTxDone(nodeStatus *pt.ParacrossNodeStatus, stat *pt.Parac
...
@@ -506,7 +515,7 @@ func (a *action) commitTxDone(nodeStatus *pt.ParacrossNodeStatus, stat *pt.Parac
saveTitleHeight
(
a
.
db
,
calcTitleHeightKey
(
stat
.
Title
,
stat
.
Height
),
stat
)
saveTitleHeight
(
a
.
db
,
calcTitleHeightKey
(
stat
.
Title
,
stat
.
Height
),
stat
)
//之前记录的stat 状态没更新
//之前记录的stat 状态没更新
if
stat
.
MainHeight
>=
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
if
isParaForkHeight
(
stat
.
MainHeight
,
pt
.
ForkLoopCheckCommitTxDone
)
{
r
:=
makeCommitStatReceipt
(
stat
)
r
:=
makeCommitStatReceipt
(
stat
)
receipt
=
mergeReceipt
(
receipt
,
r
)
receipt
=
mergeReceipt
(
receipt
,
r
)
}
}
...
@@ -529,7 +538,7 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
...
@@ -529,7 +538,7 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
titleStatus
.
Title
=
nodeStatus
.
Title
titleStatus
.
Title
=
nodeStatus
.
Title
titleStatus
.
Height
=
nodeStatus
.
Height
titleStatus
.
Height
=
nodeStatus
.
Height
titleStatus
.
BlockHash
=
nodeStatus
.
BlockHash
titleStatus
.
BlockHash
=
nodeStatus
.
BlockHash
if
a
.
exec
.
GetMainHeight
()
>=
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
if
isParaForkHeight
(
a
.
exec
.
GetMainHeight
(),
pt
.
ForkLoopCheckCommitTxDone
)
{
titleStatus
.
MainHeight
=
nodeStatus
.
MainBlockHeight
titleStatus
.
MainHeight
=
nodeStatus
.
MainBlockHeight
titleStatus
.
MainHash
=
nodeStatus
.
MainBlockHash
titleStatus
.
MainHash
=
nodeStatus
.
MainBlockHash
}
}
...
@@ -562,7 +571,7 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
...
@@ -562,7 +571,7 @@ func (a *action) commitTxDoneStep2(nodeStatus *pt.ParacrossNodeStatus, stat *pt.
func
(
a
*
action
)
procCrossTxs
(
status
*
pt
.
ParacrossNodeStatus
)
(
*
types
.
Receipt
,
error
)
{
func
(
a
*
action
)
procCrossTxs
(
status
*
pt
.
ParacrossNodeStatus
)
(
*
types
.
Receipt
,
error
)
{
haveCrossTxs
:=
len
(
status
.
CrossTxHashs
)
>
0
haveCrossTxs
:=
len
(
status
.
CrossTxHashs
)
>
0
if
status
.
Height
>
0
&&
status
.
MainBlockHeight
>=
getDappForkHeight
(
pt
.
ForkCommitTx
)
&&
len
(
status
.
CrossTxHashs
[
0
])
==
0
{
if
status
.
Height
>
0
&&
isParaForkHeight
(
status
.
MainBlockHeight
,
pt
.
ForkCommitTx
)
&&
len
(
status
.
CrossTxHashs
[
0
])
==
0
{
haveCrossTxs
=
false
haveCrossTxs
=
false
}
}
...
@@ -591,7 +600,7 @@ func (a *action) loopCommitTxDone(title string) (*types.Receipt, error) {
...
@@ -591,7 +600,7 @@ func (a *action) loopCommitTxDone(title string) (*types.Receipt, error) {
return
nil
,
errors
.
Wrapf
(
err
,
"getTitle:%s"
,
title
)
return
nil
,
errors
.
Wrapf
(
err
,
"getTitle:%s"
,
title
)
}
}
//当前共识高度还未到分叉高度,则不处理
//当前共识高度还未到分叉高度,则不处理
if
titleStatus
.
GetMainHeight
()
<
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
)
{
if
!
isParaForkHeight
(
titleStatus
.
GetMainHeight
(),
pt
.
ForkLoopCheckCommitTxDone
)
{
return
nil
,
errors
.
Wrapf
(
pt
.
ErrForkHeightNotReach
,
return
nil
,
errors
.
Wrapf
(
pt
.
ErrForkHeightNotReach
,
"titleHeight:%d,forkHeight:%d"
,
titleStatus
.
MainHeight
,
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
))
"titleHeight:%d,forkHeight:%d"
,
titleStatus
.
MainHeight
,
getDappForkHeight
(
pt
.
ForkLoopCheckCommitTxDone
))
}
}
...
@@ -737,7 +746,7 @@ func (a *action) execCrossTx(tx *types.TransactionDetail, crossTxHash []byte) (*
...
@@ -737,7 +746,7 @@ func (a *action) execCrossTx(tx *types.TransactionDetail, crossTxHash []byte) (*
}
}
func
getCrossTxHashs
(
api
client
.
QueueProtocolAPI
,
status
*
pt
.
ParacrossNodeStatus
)
([][]
byte
,
[]
byte
,
error
)
{
func
getCrossTxHashs
(
api
client
.
QueueProtocolAPI
,
status
*
pt
.
ParacrossNodeStatus
)
([][]
byte
,
[]
byte
,
error
)
{
if
status
.
MainBlockHeight
<
getDappForkHeight
(
pt
.
ForkCommitTx
)
{
if
!
isParaForkHeight
(
status
.
MainBlockHeight
,
pt
.
ForkCommitTx
)
{
return
status
.
CrossTxHashs
,
status
.
CrossTxResult
,
nil
return
status
.
CrossTxHashs
,
status
.
CrossTxResult
,
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