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
16652f7b
Commit
16652f7b
authored
Dec 06, 2019
by
mdj33
Committed by
vipwzw
Dec 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asset transfer tx improve
parent
5184c2f1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
7 deletions
+10
-7
paracross.go
plugin/dapp/paracross/commands/paracross.go
+5
-3
action.go
plugin/dapp/paracross/executor/action.go
+4
-3
exec_local.go
plugin/dapp/paracross/executor/exec_local.go
+0
-1
query.go
plugin/dapp/paracross/executor/query.go
+1
-0
No files found.
plugin/dapp/paracross/commands/paracross.go
View file @
16652f7b
...
@@ -112,7 +112,8 @@ func createAssetWithdraw(cmd *cobra.Command, args []string) {
...
@@ -112,7 +112,8 @@ func createAssetWithdraw(cmd *cobra.Command, args []string) {
}
}
func
createAssetTx
(
cmd
*
cobra
.
Command
,
isWithdraw
bool
)
(
string
,
error
)
{
func
createAssetTx
(
cmd
*
cobra
.
Command
,
isWithdraw
bool
)
(
string
,
error
)
{
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
title
,
_
:=
cmd
.
Flags
()
.
GetString
(
"title"
)
//这里cfg除了里面FormatTx需要外,没其他作用,平行链执行器需要的参数已经填好了,这里title就是默认空就可以,支持主链构建平行链交易
cfg
:=
types
.
GetCliSysParam
(
title
)
cfg
:=
types
.
GetCliSysParam
(
title
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
...
@@ -125,11 +126,12 @@ func createAssetTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
...
@@ -125,11 +126,12 @@ func createAssetTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
note
,
_
:=
cmd
.
Flags
()
.
GetString
(
"note"
)
note
,
_
:=
cmd
.
Flags
()
.
GetString
(
"note"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
if
!
strings
.
HasPrefix
(
title
,
"user.p"
)
{
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
if
!
strings
.
HasPrefix
(
paraName
,
"user.p"
)
{
fmt
.
Fprintln
(
os
.
Stderr
,
"title is not right, title format like `user.p.guodun.`"
)
fmt
.
Fprintln
(
os
.
Stderr
,
"title is not right, title format like `user.p.guodun.`"
)
return
""
,
types
.
ErrInvalidParam
return
""
,
types
.
ErrInvalidParam
}
}
execName
:=
titl
e
+
pt
.
ParaX
execName
:=
paraNam
e
+
pt
.
ParaX
param
:=
types
.
CreateTx
{
param
:=
types
.
CreateTx
{
To
:
toAddr
,
To
:
toAddr
,
...
...
plugin/dapp/paracross/executor/action.go
View file @
16652f7b
...
@@ -181,7 +181,7 @@ func makeRecordReceipt(addr string, commit *pt.ParacrossCommitAction) *types.Rec
...
@@ -181,7 +181,7 @@ func makeRecordReceipt(addr string, commit *pt.ParacrossCommitAction) *types.Rec
}
}
}
}
func
makeDoneReceipt
(
cfg
*
types
.
Chain33Config
,
execMainHeight
int64
,
commit
*
pt
.
ParacrossNodeStatus
,
func
makeDoneReceipt
(
cfg
*
types
.
Chain33Config
,
execMainHeight
,
execHeight
int64
,
commit
*
pt
.
ParacrossNodeStatus
,
most
,
commitCount
,
totalCount
int32
)
*
types
.
Receipt
{
most
,
commitCount
,
totalCount
int32
)
*
types
.
Receipt
{
log
:=
&
pt
.
ReceiptParacrossDone
{
log
:=
&
pt
.
ReceiptParacrossDone
{
...
@@ -194,6 +194,7 @@ func makeDoneReceipt(cfg *types.Chain33Config, execMainHeight int64, commit *pt.
...
@@ -194,6 +194,7 @@ func makeDoneReceipt(cfg *types.Chain33Config, execMainHeight int64, commit *pt.
TxResult
:
commit
.
TxResult
,
TxResult
:
commit
.
TxResult
,
MainBlockHeight
:
commit
.
MainBlockHeight
,
MainBlockHeight
:
commit
.
MainBlockHeight
,
MainBlockHash
:
commit
.
MainBlockHash
,
MainBlockHash
:
commit
.
MainBlockHash
,
ChainExecHeight
:
execHeight
,
}
}
key
:=
calcTitleKey
(
commit
.
Title
)
key
:=
calcTitleKey
(
commit
.
Title
)
status
:=
&
pt
.
ParacrossStatus
{
status
:=
&
pt
.
ParacrossStatus
{
...
@@ -511,7 +512,7 @@ func (a *action) commitTxDone(nodeStatus *pt.ParacrossNodeStatus, stat *pt.Parac
...
@@ -511,7 +512,7 @@ func (a *action) commitTxDone(nodeStatus *pt.ParacrossNodeStatus, stat *pt.Parac
}
}
//add commit done receipt
//add commit done receipt
receiptDone
:=
makeDoneReceipt
(
cfg
,
a
.
exec
.
GetMainHeight
(),
nodeStatus
,
int32
(
most
),
int32
(
commitCount
),
int32
(
len
(
nodes
)))
receiptDone
:=
makeDoneReceipt
(
cfg
,
a
.
exec
.
GetMainHeight
(),
a
.
height
,
nodeStatus
,
int32
(
most
),
int32
(
commitCount
),
int32
(
len
(
nodes
)))
receipt
=
mergeReceipt
(
receipt
,
receiptDone
)
receipt
=
mergeReceipt
(
receipt
,
receiptDone
)
r
,
err
:=
a
.
commitTxDoneStep2
(
nodeStatus
,
stat
,
titleStatus
)
r
,
err
:=
a
.
commitTxDoneStep2
(
nodeStatus
,
stat
,
titleStatus
)
...
@@ -696,7 +697,7 @@ func (a *action) commitTxDoneByStat(stat *pt.ParacrossHeightStatus, titleStatus
...
@@ -696,7 +697,7 @@ func (a *action) commitTxDoneByStat(stat *pt.ParacrossHeightStatus, titleStatus
//add commit done receipt
//add commit done receipt
cfg
:=
a
.
api
.
GetConfig
()
cfg
:=
a
.
api
.
GetConfig
()
receiptDone
:=
makeDoneReceipt
(
cfg
,
a
.
exec
.
GetMainHeight
(),
mostStatus
,
int32
(
most
),
int32
(
commitCount
),
int32
(
len
(
nodes
)))
receiptDone
:=
makeDoneReceipt
(
cfg
,
a
.
exec
.
GetMainHeight
(),
a
.
height
,
mostStatus
,
int32
(
most
),
int32
(
commitCount
),
int32
(
len
(
nodes
)))
receipt
=
mergeReceipt
(
receipt
,
receiptDone
)
receipt
=
mergeReceipt
(
receipt
,
receiptDone
)
r
,
err
:=
a
.
commitTxDoneStep2
(
mostStatus
,
stat
,
titleStatus
)
r
,
err
:=
a
.
commitTxDoneStep2
(
mostStatus
,
stat
,
titleStatus
)
...
...
plugin/dapp/paracross/executor/exec_local.go
View file @
16652f7b
...
@@ -30,7 +30,6 @@ func (e *Paracross) ExecLocal_Commit(payload *pt.ParacrossCommitAction, tx *type
...
@@ -30,7 +30,6 @@ func (e *Paracross) ExecLocal_Commit(payload *pt.ParacrossCommitAction, tx *type
}
else
if
log
.
Ty
==
pt
.
TyLogParacrossCommitDone
{
}
else
if
log
.
Ty
==
pt
.
TyLogParacrossCommitDone
{
var
g
pt
.
ReceiptParacrossDone
var
g
pt
.
ReceiptParacrossDone
types
.
Decode
(
log
.
Log
,
&
g
)
types
.
Decode
(
log
.
Log
,
&
g
)
g
.
ChainExecHeight
=
e
.
GetHeight
()
key
:=
calcLocalTitleKey
(
g
.
Title
)
key
:=
calcLocalTitleKey
(
g
.
Title
)
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
&
g
)})
set
.
KV
=
append
(
set
.
KV
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
&
g
)})
...
...
plugin/dapp/paracross/executor/query.go
View file @
16652f7b
...
@@ -300,6 +300,7 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) {
...
@@ -300,6 +300,7 @@ func listLocalTitles(db dbm.KVDB) (types.Message, error) {
MostSameCommit
:
st
.
MostSameCommit
,
MostSameCommit
:
st
.
MostSameCommit
,
Title
:
st
.
Title
,
Title
:
st
.
Title
,
Height
:
st
.
Height
,
Height
:
st
.
Height
,
ChainExecHeight
:
st
.
ChainExecHeight
,
TxResult
:
string
(
st
.
TxResult
),
TxResult
:
string
(
st
.
TxResult
),
}
}
...
...
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