OSDN Git Service
(root)
/
bytom
/
vapor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
96b79e7
)
validate vote pubkey (#128)
author
muscle_boy
<shenao.78@163.com>
Tue, 4 Jun 2019 07:40:43 +0000
(15:40 +0800)
committer
Paladz
<yzhu101@uottawa.ca>
Tue, 4 Jun 2019 07:40:43 +0000
(15:40 +0800)
protocol/validation/tx.go
patch
|
blob
|
history
diff --git
a/protocol/validation/tx.go
b/protocol/validation/tx.go
index
14d1b87
..
d7cc42b
100644
(file)
--- a/
protocol/validation/tx.go
+++ b/
protocol/validation/tx.go
@@
-38,6
+38,7
@@
var (
ErrUnbalanced = errors.New("unbalanced asset amount between input and output")
ErrOverGasCredit = errors.New("all gas credit has been spend")
ErrGasCalculate = errors.New("gas usage calculate got a math error")
ErrUnbalanced = errors.New("unbalanced asset amount between input and output")
ErrOverGasCredit = errors.New("all gas credit has been spend")
ErrGasCalculate = errors.New("gas usage calculate got a math error")
+ ErrVotePubKey = errors.New("invalid public key of vote")
)
// GasState record the gas usage status
)
// GasState record the gas usage status
@@
-227,6
+228,9
@@
func checkValid(vs *validationState, e bc.Entry) (err error) {
}
case *bc.VoteOutput:
}
case *bc.VoteOutput:
+ if len(e.Vote) != 64 {
+ return ErrVotePubKey
+ }
vs2 := *vs
vs2.sourcePos = 0
if err = checkValidSrc(&vs2, e.Source); err != nil {
vs2 := *vs
vs2.sourcePos = 0
if err = checkValidSrc(&vs2, e.Source); err != nil {
@@
-270,6
+274,9
@@
func checkValid(vs *validationState, e bc.Entry) (err error) {
controlProgram = output.ControlProgram
value = output.Source.Value
case *bc.VoteOutput:
controlProgram = output.ControlProgram
value = output.Source.Value
case *bc.VoteOutput:
+ if len(output.Vote) != 64 {
+ return ErrVotePubKey
+ }
controlProgram = output.ControlProgram
value = output.Source.Value
default:
controlProgram = output.ControlProgram
value = output.Source.Value
default: