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
2f5cc38f
Commit
2f5cc38f
authored
May 20, 2019
by
mdj33
Committed by
vipwzw
May 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support account frozen coins on behalf of other
parent
3e747050
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+13
-10
paracross.proto
plugin/dapp/paracross/proto/paracross.proto
+1
-0
No files found.
plugin/dapp/paracross/executor/superaccount.go
View file @
2f5cc38f
...
@@ -158,8 +158,9 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -158,8 +158,9 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
errors
.
Wrapf
(
err
,
"getNodes for title:%s"
,
config
.
Title
)
return
nil
,
errors
.
Wrapf
(
err
,
"getNodes for title:%s"
,
config
.
Title
)
}
}
if
validNode
(
a
.
fromaddr
,
nodes
)
{
//有可能申请地址和配置地址不是同一个
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeAddrExisted
,
"nodeAddr existed:%s"
,
a
.
fromaddr
)
if
validNode
(
config
.
Addr
,
nodes
)
{
return
nil
,
errors
.
Wrapf
(
pt
.
ErrParaNodeAddrExisted
,
"nodeAddr existed:%s"
,
config
.
Addr
)
}
}
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
...
@@ -181,6 +182,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -181,6 +182,7 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
stat
:=
&
pt
.
ParaNodeAddrStatus
{
Status
:
pt
.
ParacrossNodeAdding
,
stat
:=
&
pt
.
ParaNodeAddrStatus
{
Status
:
pt
.
ParacrossNodeAdding
,
Title
:
config
.
Title
,
Title
:
config
.
Title
,
ApplyAddr
:
config
.
Addr
,
ApplyAddr
:
config
.
Addr
,
FromAddr
:
a
.
fromaddr
,
Votes
:
&
pt
.
ParaNodeVoteDetail
{},
Votes
:
&
pt
.
ParaNodeVoteDetail
{},
CoinsFrozen
:
config
.
CoinsFrozen
}
CoinsFrozen
:
config
.
CoinsFrozen
}
saveNodeAddr
(
a
.
db
,
config
.
Title
,
config
.
Addr
,
stat
)
saveNodeAddr
(
a
.
db
,
config
.
Title
,
config
.
Addr
,
stat
)
...
@@ -200,9 +202,13 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -200,9 +202,13 @@ func (a *action) nodeJoin(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
clog
.
Error
(
"nodeaccount.nodeJoin key exist"
,
"addr"
,
config
.
Addr
,
"status"
,
stat
)
clog
.
Error
(
"nodeaccount.nodeJoin key exist"
,
"addr"
,
config
.
Addr
,
"status"
,
stat
)
return
nil
,
pt
.
ErrParaNodeAddrExisted
return
nil
,
pt
.
ErrParaNodeAddrExisted
}
}
stat
.
Status
=
pt
.
ParacrossNodeAdding
stat
=
&
pt
.
ParaNodeAddrStatus
{
stat
.
CoinsFrozen
=
config
.
CoinsFrozen
Status
:
pt
.
ParacrossNodeAdding
,
stat
.
Votes
=
&
pt
.
ParaNodeVoteDetail
{}
Title
:
config
.
Title
,
ApplyAddr
:
config
.
Addr
,
FromAddr
:
a
.
fromaddr
,
Votes
:
&
pt
.
ParaNodeVoteDetail
{},
CoinsFrozen
:
config
.
CoinsFrozen
}
saveNodeAddr
(
a
.
db
,
config
.
Title
,
config
.
Addr
,
stat
)
saveNodeAddr
(
a
.
db
,
config
.
Title
,
config
.
Addr
,
stat
)
r
:=
makeNodeConfigReceipt
(
a
.
fromaddr
,
config
,
&
copyStat
,
stat
)
r
:=
makeNodeConfigReceipt
(
a
.
fromaddr
,
config
,
&
copyStat
,
stat
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
receipt
.
KV
=
append
(
receipt
.
KV
,
r
.
KV
...
)
...
@@ -252,7 +258,7 @@ func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -252,7 +258,7 @@ func (a *action) nodeQuit(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
//still adding status, quit directly
//still adding status, quit directly
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
if
!
types
.
IsPara
()
{
if
!
types
.
IsPara
()
{
r
,
err
:=
a
.
nodeGroupCoinsActive
([]
string
{
a
.
froma
ddr
},
stat
.
CoinsFrozen
)
r
,
err
:=
a
.
nodeGroupCoinsActive
([]
string
{
stat
.
FromA
ddr
},
stat
.
CoinsFrozen
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -432,7 +438,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
...
@@ -432,7 +438,7 @@ func (a *action) nodeVote(config *pt.ParaNodeAddrConfig) (*types.Receipt, error)
stat
.
Status
=
pt
.
ParacrossNodeQuited
stat
.
Status
=
pt
.
ParacrossNodeQuited
if
!
types
.
IsPara
()
{
if
!
types
.
IsPara
()
{
r
,
err
:=
a
.
nodeGroupCoinsActive
([]
string
{
stat
.
Apply
Addr
},
stat
.
CoinsFrozen
)
r
,
err
:=
a
.
nodeGroupCoinsActive
([]
string
{
stat
.
From
Addr
},
stat
.
CoinsFrozen
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -829,9 +835,6 @@ func (a *action) NodeConfig(config *pt.ParaNodeAddrConfig) (*types.Receipt, erro
...
@@ -829,9 +835,6 @@ func (a *action) NodeConfig(config *pt.ParaNodeAddrConfig) (*types.Receipt, erro
}
}
if
config
.
Op
==
pt
.
ParaNodeJoin
{
if
config
.
Op
==
pt
.
ParaNodeJoin
{
if
config
.
Addr
!=
a
.
fromaddr
{
return
nil
,
types
.
ErrFromAddr
}
return
a
.
nodeJoin
(
config
)
return
a
.
nodeJoin
(
config
)
}
else
if
config
.
Op
==
pt
.
ParaNodeQuit
{
}
else
if
config
.
Op
==
pt
.
ParaNodeQuit
{
...
...
plugin/dapp/paracross/proto/paracross.proto
View file @
2f5cc38f
...
@@ -55,6 +55,7 @@ message ParaNodeAddrStatus{
...
@@ -55,6 +55,7 @@ message ParaNodeAddrStatus{
string
applyAddr
=
3
;
string
applyAddr
=
3
;
int64
coinsFrozen
=
4
;
int64
coinsFrozen
=
4
;
ParaNodeVoteDetail
votes
=
5
;
ParaNodeVoteDetail
votes
=
5
;
string
fromAddr
=
6
;
}
}
...
...
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