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
1fb4c5b2
Unverified
Commit
1fb4c5b2
authored
Dec 07, 2018
by
vipwzw
Committed by
GitHub
Dec 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #116 from mdj33/ISSUE114_para_filterTx
issue 114 filter tx with title
parents
b5e1f9d7
71099b46
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
6 deletions
+29
-6
para.go
plugin/consensus/para/para.go
+2
-2
para_test.go
plugin/consensus/para/para_test.go
+24
-1
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+2
-2
paracross.go
plugin/dapp/paracross/executor/paracross.go
+1
-1
No files found.
plugin/consensus/para/para.go
View file @
1fb4c5b2
...
...
@@ -251,7 +251,7 @@ func calcParaCrossTxGroup(tx *types.Transaction, main *types.BlockDetail, index
endIdx
:=
headIdx
+
int
(
tx
.
GroupCount
)
for
i
:=
headIdx
;
i
<
endIdx
;
i
++
{
if
types
.
IsParaExecName
(
string
(
main
.
Block
.
Txs
[
i
]
.
Execer
))
{
if
types
.
Is
My
ParaExecName
(
string
(
main
.
Block
.
Txs
[
i
]
.
Execer
))
{
continue
}
if
main
.
Receipts
[
i
]
.
Ty
==
types
.
ExecOk
{
...
...
@@ -272,7 +272,7 @@ func (client *client) FilterTxsForPara(main *types.BlockDetail) []*types.Transac
var
txs
[]
*
types
.
Transaction
for
i
:=
0
;
i
<
len
(
main
.
Block
.
Txs
);
i
++
{
tx
:=
main
.
Block
.
Txs
[
i
]
if
types
.
IsParaExecName
(
string
(
tx
.
Execer
))
{
if
types
.
Is
My
ParaExecName
(
string
(
tx
.
Execer
))
{
if
tx
.
GroupCount
>=
paraCrossTxCount
{
mainTxs
,
endIdx
:=
calcParaCrossTxGroup
(
tx
,
main
,
i
)
txs
=
append
(
txs
,
mainTxs
...
)
...
...
plugin/consensus/para/para_test.go
View file @
1fb4c5b2
...
...
@@ -19,6 +19,7 @@ import (
var
(
Amount
=
int64
(
1
*
types
.
Coin
)
Title
=
string
(
"user.p.para."
)
Title2
=
string
(
"user.p.test."
)
)
func
TestFilterTxsForPara
(
t
*
testing
.
T
)
{
...
...
@@ -72,6 +73,10 @@ func TestFilterTxsForPara(t *testing.T) {
txGroupBC
,
err
:=
createTxsGroup
(
txBC
)
assert
.
Nil
(
t
,
err
)
//single para tx
txD
,
err
:=
createCrossParaTempTx
(
"toB"
,
10
)
assert
.
Nil
(
t
,
err
)
txs
:=
[]
*
types
.
Transaction
{
tx0
}
txs
=
append
(
txs
,
txGroup12
...
)
txs
=
append
(
txs
,
txGroup34
...
)
...
...
@@ -79,6 +84,7 @@ func TestFilterTxsForPara(t *testing.T) {
txs
=
append
(
txs
,
txGroup78
...
)
txs
=
append
(
txs
,
tx9
,
txA
)
txs
=
append
(
txs
,
txGroupBC
...
)
txs
=
append
(
txs
,
txD
)
//for i, tx := range txs {
// t.Log("tx exec name", "i", i, "name", string(tx.Execer))
...
...
@@ -101,8 +107,9 @@ func TestFilterTxsForPara(t *testing.T) {
recptA
:=
&
types
.
ReceiptData
{
Ty
:
types
.
ExecPack
}
recptB
:=
&
types
.
ReceiptData
{
Ty
:
types
.
ExecPack
}
recptC
:=
&
types
.
ReceiptData
{
Ty
:
types
.
ExecPack
}
recptD
:=
&
types
.
ReceiptData
{
Ty
:
types
.
ExecPack
}
receipts
:=
[]
*
types
.
ReceiptData
{
recpt0
,
recpt1
,
recpt2
,
recpt3
,
recpt4
,
recpt5
,
recpt6
,
recpt7
,
recpt8
,
recpt9
,
recptA
,
recptB
,
recptC
}
recpt6
,
recpt7
,
recpt8
,
recpt9
,
recptA
,
recptB
,
recptC
,
recptD
}
block
:=
&
types
.
Block
{
Txs
:
txs
}
detail
:=
&
types
.
BlockDetail
{
...
...
@@ -187,6 +194,22 @@ func createCrossParaTx(to string, amount int64) (*types.Transaction, error) {
return
tx
,
err
}
func
createCrossParaTempTx
(
to
string
,
amount
int64
)
(
*
types
.
Transaction
,
error
)
{
param
:=
types
.
CreateTx
{
To
:
string
(
to
),
Amount
:
amount
,
Fee
:
0
,
Note
:
[]
byte
(
"test asset transfer"
),
IsWithdraw
:
false
,
IsToken
:
false
,
TokenSymbol
:
""
,
ExecName
:
Title2
+
pt
.
ParaX
,
}
tx
,
err
:=
pt
.
CreateRawAssetTransferTx
(
&
param
)
return
tx
,
err
}
func
createTxsGroup
(
txs
[]
*
types
.
Transaction
)
([]
*
types
.
Transaction
,
error
)
{
group
,
err
:=
types
.
CreateTxGroup
(
txs
)
...
...
plugin/dapp/paracross/executor/exec_local.go
View file @
1fb4c5b2
...
...
@@ -86,7 +86,7 @@ func (e *Paracross) ExecLocal_Miner(payload *pt.ParacrossMinerAction, tx *types.
hash
:=
tx
.
Hash
()
mixTxHashs
=
append
(
mixTxHashs
,
hash
)
//跨链交易包含了主链交易,需要过滤出来
if
types
.
IsParaExecName
(
string
(
tx
.
Execer
))
{
if
types
.
Is
My
ParaExecName
(
string
(
tx
.
Execer
))
{
paraTxHashs
=
append
(
paraTxHashs
,
hash
)
}
}
...
...
@@ -100,7 +100,7 @@ func (e *Paracross) ExecLocal_Miner(payload *pt.ParacrossMinerAction, tx *types.
i
=
int
(
end
)
-
1
continue
}
if
types
.
IsParaExecName
(
string
(
tx
.
Execer
))
&&
if
types
.
Is
My
ParaExecName
(
string
(
tx
.
Execer
))
&&
bytes
.
HasSuffix
(
tx
.
Execer
,
[]
byte
(
pt
.
ParaX
))
{
crossTxHashs
=
append
(
crossTxHashs
,
tx
.
Hash
())
}
...
...
plugin/dapp/paracross/executor/paracross.go
View file @
1fb4c5b2
...
...
@@ -87,7 +87,7 @@ func crossTxGroupProc(txs []*types.Transaction, index int) ([]*types.Transaction
//cross asset transfer in tx group
var
transfers
[]
*
types
.
Transaction
for
i
:=
headIdx
;
i
<
endIdx
;
i
++
{
if
types
.
IsParaExecName
(
string
(
txs
[
i
]
.
Execer
))
&&
if
types
.
Is
My
ParaExecName
(
string
(
txs
[
i
]
.
Execer
))
&&
bytes
.
HasSuffix
(
txs
[
i
]
.
Execer
,
[]
byte
(
pt
.
ParaX
))
{
transfers
=
append
(
transfers
,
txs
[
i
])
...
...
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