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
a32e1618
Commit
a32e1618
authored
Feb 18, 2019
by
jiangpeng
Committed by
33cn
Feb 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix db get nil value check
parent
b26a33b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
privacy.go
plugin/dapp/privacy/executor/privacy.go
+5
-5
No files found.
plugin/dapp/privacy/executor/privacy.go
View file @
a32e1618
...
...
@@ -251,7 +251,7 @@ func (p *privacy) CheckTx(tx *types.Transaction, index int) error {
input
:=
keyinput
[
errIndex
]
privacylog
.
Error
(
"PrivacyTrading CheckTx"
,
"txhash"
,
txhashstr
,
"UTXO spent already errindex"
,
errIndex
,
"utxo amout"
,
input
.
Amount
/
types
.
Coin
,
"utxo keyimage"
,
common
.
ToHex
(
input
.
KeyImage
))
}
privacylog
.
Error
(
"PrivacyTrading CheckTx"
,
"txhash"
,
txhashstr
,
"checkUTXOValid failed "
)
privacylog
.
Error
(
"PrivacyTrading CheckTx"
,
"txhash"
,
txhashstr
,
"
err"
,
"
checkUTXOValid failed "
)
return
pty
.
ErrDoubleSpendOccur
}
...
...
@@ -293,7 +293,7 @@ func (p *privacy) CheckTx(tx *types.Transaction, index int) error {
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
{
if
err
!=
nil
&&
err
!=
types
.
ErrNotFound
{
return
nil
,
err
}
values
=
append
(
values
,
v
)
...
...
@@ -306,11 +306,11 @@ func (p *privacy) checkUTXOValid(keyImages [][]byte) (bool, int32) {
stateDB
:=
p
.
GetStateDB
()
values
,
err
:=
batchGet
(
stateDB
,
keyImages
)
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"
,
err
)
return
false
,
invalidIndex
}
if
len
(
values
)
!=
len
(
keyImages
)
{
privacylog
.
Error
(
"exec module"
,
"checkUTXOValid return different count value with keys"
)
privacylog
.
Error
(
"exec module"
,
"
err"
,
"
checkUTXOValid return different count value with keys"
)
return
false
,
invalidIndex
}
for
i
,
value
:=
range
values
{
...
...
@@ -331,7 +331,7 @@ func (p *privacy) checkPubKeyValid(keys [][]byte, pubkeys [][]byte) (bool, int32
}
if
len
(
values
)
!=
len
(
pubkeys
)
{
privacylog
.
Error
(
"exec module"
,
"checkPubKeyValid return different count value with keys"
)
privacylog
.
Error
(
"exec module"
,
"
err"
,
"
checkPubKeyValid return different count value with keys"
)
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