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
2c015735
Commit
2c015735
authored
Feb 05, 2021
by
jiangpeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dapp/vote:check group admin addr in checktx
parent
fdef66ed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
go.sum
go.sum
+0
-0
checktx.go
plugin/dapp/vote/executor/checktx.go
+12
-2
errors.go
plugin/dapp/vote/executor/errors.go
+1
-1
No files found.
go.sum
View file @
2c015735
This diff is collapsed.
Click to expand it.
plugin/dapp/vote/executor/checktx.go
View file @
2c015735
...
...
@@ -3,6 +3,8 @@ package executor
import
(
"encoding/hex"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
vty
"github.com/33cn/plugin/plugin/dapp/vote/types"
)
...
...
@@ -84,7 +86,7 @@ func (v *vote) checkUpdateGroup(update *vty.UpdateGroup, tx *types.Transaction,
}
//防止将管理员全部删除
if
len
(
update
.
RemoveAdmins
)
>=
len
(
update
.
AddAdmins
)
+
len
(
groupInfo
.
GetAdmins
())
{
if
len
(
update
.
RemoveAdmins
)
>=
len
(
groupInfo
.
GetAdmins
())
&&
len
(
update
.
AddAdmins
)
==
0
{
return
errAddrPermissionDenied
}
...
...
@@ -105,6 +107,14 @@ func (v *vote) checkUpdateGroup(update *vty.UpdateGroup, tx *types.Transaction,
}
}
//保证管理员地址合法性
for
_
,
addr
:=
range
update
.
GetAddAdmins
()
{
if
err
:=
dapp
.
CheckAddress
(
v
.
GetAPI
()
.
GetConfig
(),
addr
,
v
.
GetHeight
());
err
!=
nil
{
elog
.
Error
(
"checkUpdateGroup"
,
"addr"
,
addr
,
"CheckAddress err"
,
err
)
return
types
.
ErrInvalidAddress
}
}
return
nil
}
...
...
@@ -166,7 +176,7 @@ func (v *vote) checkCommitVote(commit *vty.CommitVote, tx *types.Transaction, in
// check if already vote
for
_
,
info
:=
range
voteInfo
.
GetCommitInfos
()
{
if
action
.
fromAddr
==
info
.
Addr
{
return
errAlreadyVoted
return
errA
ddrA
lreadyVoted
}
}
...
...
plugin/dapp/vote/executor/errors.go
View file @
2c015735
...
...
@@ -18,7 +18,7 @@ var (
errInvalidVoteID
=
errors
.
New
(
"errInvalidVoteID"
)
errInvalidGroupID
=
errors
.
New
(
"errInvalidGroupID"
)
errInvalidOptionIndex
=
errors
.
New
(
"errInvalidOptionIndex"
)
errA
lreadyVoted
=
errors
.
New
(
"er
rAlreadyVoted"
)
errA
ddrAlreadyVoted
=
errors
.
New
(
"errAdd
rAlreadyVoted"
)
errInvalidGroupMember
=
errors
.
New
(
"errInvalidGroupMember"
)
errVoteAlreadyFinished
=
errors
.
New
(
"errVoteAlreadyFinished"
)
errVoteAlreadyClosed
=
errors
.
New
(
"errVoteAlreadyClosed"
)
...
...
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