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
6afcd5b4
Commit
6afcd5b4
authored
Feb 15, 2019
by
kingwang
Committed by
33cn
Feb 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix linter
parent
aeb74e5d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
privacy.go
plugin/dapp/privacy/executor/privacy.go
+14
-2
No files found.
plugin/dapp/privacy/executor/privacy.go
View file @
6afcd5b4
...
@@ -27,6 +27,7 @@ import (
...
@@ -27,6 +27,7 @@ import (
"time"
"time"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/db"
log
"github.com/33cn/chain33/common/log/log15"
log
"github.com/33cn/chain33/common/log/log15"
drivers
"github.com/33cn/chain33/system/dapp"
drivers
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
...
@@ -289,10 +290,21 @@ func (p *privacy) CheckTx(tx *types.Transaction, index int) error {
...
@@ -289,10 +290,21 @@ func (p *privacy) CheckTx(tx *types.Transaction, index int) error {
return
nil
return
nil
}
}
func
batchGet
(
stateDB
db
.
KV
,
keyImages
[][]
byte
)
(
values
[][]
byte
,
err
error
)
{
for
i
:=
0
;
i
<
len
(
keyImages
);
i
++
{
v
,
err
:=
stateDB
.
Get
(
keyImages
[
i
])
if
err
!=
nil
{
return
nil
,
err
}
values
=
append
(
values
,
v
)
}
return
values
,
nil
}
//通过keyImage确认是否存在双花,有效即不存在双花,返回true,反之则返回false
//通过keyImage确认是否存在双花,有效即不存在双花,返回true,反之则返回false
func
(
p
*
privacy
)
checkUTXOValid
(
keyImages
[][]
byte
)
(
bool
,
int32
)
{
func
(
p
*
privacy
)
checkUTXOValid
(
keyImages
[][]
byte
)
(
bool
,
int32
)
{
stateDB
:=
p
.
GetStateDB
()
stateDB
:=
p
.
GetStateDB
()
values
,
err
:=
stateDB
.
BatchGet
(
keyImages
)
values
,
err
:=
batchGet
(
stateDB
,
keyImages
)
if
err
!=
nil
{
if
err
!=
nil
{
privacylog
.
Error
(
"exec module"
,
"checkUTXOValid failed to get value from statDB"
)
privacylog
.
Error
(
"exec module"
,
"checkUTXOValid failed to get value from statDB"
)
return
false
,
invalidIndex
return
false
,
invalidIndex
...
@@ -312,7 +324,7 @@ func (p *privacy) checkUTXOValid(keyImages [][]byte) (bool, int32) {
...
@@ -312,7 +324,7 @@ func (p *privacy) checkUTXOValid(keyImages [][]byte) (bool, int32) {
}
}
func
(
p
*
privacy
)
checkPubKeyValid
(
keys
[][]
byte
,
pubkeys
[][]
byte
)
(
bool
,
int32
)
{
func
(
p
*
privacy
)
checkPubKeyValid
(
keys
[][]
byte
,
pubkeys
[][]
byte
)
(
bool
,
int32
)
{
values
,
err
:=
p
.
GetStateDB
()
.
BatchGet
(
keys
)
values
,
err
:=
batchGet
(
p
.
GetStateDB
(),
keys
)
if
err
!=
nil
{
if
err
!=
nil
{
privacylog
.
Error
(
"exec module"
,
"checkPubKeyValid failed to get value from statDB with err"
,
err
)
privacylog
.
Error
(
"exec module"
,
"checkPubKeyValid failed to get value from statDB with err"
,
err
)
return
false
,
invalidIndex
return
false
,
invalidIndex
...
...
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