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
752dfbd8
Commit
752dfbd8
authored
Apr 17, 2019
by
mdj33
Committed by
vipwzw
Apr 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added commit tx expire and only resend 1 time
parent
0dfaf0ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
17 deletions
+11
-17
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+8
-15
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+2
-2
paracross.go
plugin/dapp/paracross/types/paracross.go
+1
-0
No files found.
plugin/consensus/para/paracommitmsg.go
View file @
752dfbd8
...
...
@@ -286,11 +286,7 @@ func (client *commitMsgClient) singleCalcTx(status *pt.ParacrossNodeStatus) (*ty
}
// 从ch收到tx有两种可能,readTick和addBlock, 如果
// 3 input case from ch: readTick , addBlock and delMsg to readTick, readTick trigger firstly and will block until received from addBlock
// if sendCommitMsgTx block quite long, write channel will be block in handle(), addBlock will not send new msg until rpc send over
// if sendCommitMsgTx block quite long, if delMsg occur, after send over, ignore previous tx succ or fail, new msg will be rcv and sent
// if sendCommitMsgTx fail, wait 1s resend the failed tx, if new tx rcv from ch, send the new one.
func
(
client
*
commitMsgClient
)
sendCommitMsg
(
ch
chan
*
types
.
Transaction
)
{
var
err
error
var
tx
*
types
.
Transaction
...
...
@@ -301,15 +297,12 @@ out:
select
{
case
tx
=
<-
ch
:
err
=
client
.
sendCommitMsgTx
(
tx
)
if
err
!=
nil
&&
err
!=
types
.
ErrBalanceLessThanTenTimesFee
{
resendTimer
=
time
.
After
(
time
.
Second
*
1
)
if
err
!=
nil
&&
(
err
!=
types
.
ErrBalanceLessThanTenTimesFee
&&
err
!=
types
.
ErrNoBalance
)
{
resendTimer
=
time
.
After
(
time
.
Second
*
2
)
}
case
<-
resendTimer
:
if
err
!=
nil
&&
tx
!=
nil
{
err
=
client
.
sendCommitMsgTx
(
tx
)
if
err
!=
nil
&&
err
!=
types
.
ErrBalanceLessThanTenTimesFee
{
resendTimer
=
time
.
After
(
time
.
Second
*
1
)
}
client
.
sendCommitMsgTx
(
tx
)
}
case
<-
client
.
quit
:
break
out
...
...
@@ -339,15 +332,15 @@ func (client *commitMsgClient) sendCommitMsgTx(tx *types.Transaction) error {
}
func
checkTxInMainBlock
(
targetTx
*
types
.
Transaction
,
detail
*
types
.
BlockDetail
)
bool
{
t
argetHash
:=
targetTx
.
Hash
(
)
t
xMap
:=
make
(
map
[
string
]
bool
)
for
i
,
tx
:=
range
detail
.
Block
.
Txs
{
if
bytes
.
Equal
(
targetHash
,
tx
.
Hash
(
))
&&
detail
.
Receipts
[
i
]
.
Ty
==
types
.
ExecOk
{
return
true
if
bytes
.
HasSuffix
(
tx
.
Execer
,
[]
byte
(
pt
.
ParaX
))
&&
detail
.
Receipts
[
i
]
.
Ty
==
types
.
ExecOk
{
txMap
[
string
(
tx
.
Hash
())]
=
true
}
}
return
false
return
txMap
[
string
(
targetTx
.
Hash
())]
}
func
isParaSelfConsensusForked
(
height
int64
)
bool
{
...
...
plugin/dapp/paracross/executor/exec_local.go
View file @
752dfbd8
...
...
@@ -112,9 +112,9 @@ func setMinerTxResult(payload *pt.ParacrossMinerAction, txs []*types.Transaction
}
crossTxHashs
:=
FilterParaMainCrossTxHashes
(
types
.
GetTitle
(),
txs
)
payload
.
Status
.
TxHashs
=
paraTxHashs
payload
.
Status
.
TxResult
=
util
.
Calc
SubBitMap
(
curTxHashs
,
para
TxHashs
,
receipts
)
payload
.
Status
.
TxResult
=
util
.
Calc
BitMap
(
paraTxHashs
,
cur
TxHashs
,
receipts
)
payload
.
Status
.
CrossTxHashs
=
crossTxHashs
payload
.
Status
.
CrossTxResult
=
util
.
Calc
SubBitMap
(
curTxHashs
,
cross
TxHashs
,
receipts
)
payload
.
Status
.
CrossTxResult
=
util
.
Calc
BitMap
(
crossTxHashs
,
cur
TxHashs
,
receipts
)
}
...
...
plugin/dapp/paracross/types/paracross.go
View file @
752dfbd8
...
...
@@ -152,6 +152,7 @@ func createRawCommitTx(status *ParacrossNodeStatus, name string, fee int64) (*ty
Payload
:
types
.
Encode
(
action
),
Fee
:
fee
,
To
:
address
.
ExecAddress
(
name
),
Expire
:
types
.
Now
()
.
Unix
()
+
int64
(
120
),
//120s
}
tx
,
err
:=
types
.
FormatTx
(
name
,
tx
)
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