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
64d7f9ee
Commit
64d7f9ee
authored
May 29, 2019
by
mdj33
Committed by
vipwzw
May 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trim possible blank
parent
bdbcf64d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
1 deletion
+33
-1
superaccount.go
plugin/dapp/paracross/executor/superaccount.go
+6
-1
superaccount_test.go
plugin/dapp/paracross/executor/superaccount_test.go
+25
-0
paracross.go
plugin/dapp/paracross/types/paracross.go
+2
-0
No files found.
plugin/dapp/paracross/executor/superaccount.go
View file @
64d7f9ee
...
...
@@ -524,6 +524,10 @@ func (a *action) checkConfig(title string) error {
}
func
getAddrGroup
(
addr
string
)
[]
string
{
addr
=
strings
.
Trim
(
addr
,
" "
)
if
addr
==
""
{
return
nil
}
if
strings
.
Contains
(
addr
,
","
)
{
repeats
:=
make
(
map
[
string
]
bool
)
var
addrs
[]
string
...
...
@@ -619,11 +623,12 @@ func (a *action) nodeGroupApply(config *pt.ParaNodeGroupConfig) (*types.Receipt,
}
addrs
:=
getAddrGroup
(
config
.
Addrs
)
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
if
len
(
addrs
)
==
0
{
clog
.
Error
(
"node group apply addrs null"
,
"addrs"
,
config
.
Addrs
)
return
nil
,
types
.
ErrInvalidParam
}
receipt
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
}
//main chain
if
!
types
.
IsPara
()
{
r
,
err
:=
a
.
nodeGroupCoinsFrozen
(
a
.
fromaddr
,
config
.
CoinsFrozen
,
int64
(
len
(
addrs
)))
...
...
plugin/dapp/paracross/executor/superaccount_test.go
View file @
64d7f9ee
...
...
@@ -306,3 +306,27 @@ func TestNodeManageSuite(t *testing.T) {
func
(
suite
*
NodeManageTestSuite
)
TearDownSuite
()
{
}
func
TestGetAddrGroup
(
t
*
testing
.
T
){
addrs
:=
" 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4, 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR, 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k, ,,, 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs , "
retAddrs
:=
getAddrGroup
(
addrs
)
expectAddrs
:=
[]
string
{
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
,
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
,
"1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"
,
"1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
}
assert
.
Equal
(
t
,
expectAddrs
,
retAddrs
)
addrs
=
" 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4 , , "
retAddrs
=
getAddrGroup
(
addrs
)
expectAddrs
=
[]
string
{
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
}
assert
.
Equal
(
t
,
expectAddrs
,
retAddrs
)
addrs
=
" , "
ret
:=
getAddrGroup
(
addrs
)
assert
.
Equal
(
t
,[]
string
(
nil
),
ret
)
assert
.
Equal
(
t
,
0
,
len
(
ret
))
addrs
=
" "
ret
=
getAddrGroup
(
addrs
)
assert
.
Equal
(
t
,[]
string
(
nil
),
ret
)
assert
.
Equal
(
t
,
0
,
len
(
ret
))
}
\ No newline at end of file
plugin/dapp/paracross/types/paracross.go
View file @
64d7f9ee
...
...
@@ -7,6 +7,7 @@ package types
import
(
"encoding/json"
"fmt"
"strings"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/common/log/log15"
...
...
@@ -177,6 +178,7 @@ func createRawCommitTx(status *ParacrossNodeStatus, name string, fee int64) (*ty
// CreateRawNodeConfigTx create raw tx for node config
func
CreateRawNodeConfigTx
(
config
*
ParaNodeAddrConfig
)
(
*
types
.
Transaction
,
error
)
{
config
.
Title
=
types
.
GetTitle
()
config
.
Addr
=
strings
.
Trim
(
config
.
Addr
,
" "
)
action
:=
&
ParacrossAction
{
Ty
:
ParacrossActionNodeConfig
,
...
...
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