File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ func (tx *SignedTransaction) Validate(store DataStore) error {
88
88
return fmt .Errorf ("invalid tx version %d" , tx .Version )
89
89
}
90
90
91
+ if len (tx .Inputs ) < 1 || len (tx .Outputs ) < 1 {
92
+ return fmt .Errorf ("invalid tx inputs or outputs %d %d" , len (tx .Inputs ), len (tx .Outputs ))
93
+ }
94
+
91
95
if len (tx .Inputs ) != len (tx .Signatures ) {
92
96
return fmt .Errorf ("invalid tx signature number %d %d" , len (tx .Inputs ), len (tx .Signatures ))
93
97
}
@@ -206,7 +210,7 @@ func (tx *SignedTransaction) Validate(store DataStore) error {
206
210
}
207
211
}
208
212
209
- if inputAmount .Cmp (outputAmount ) != 0 {
213
+ if inputAmount .Sign () <= 0 || inputAmount . Cmp (outputAmount ) != 0 {
210
214
return fmt .Errorf ("invalid input output amount %s %s" , inputAmount .String (), outputAmount .String ())
211
215
}
212
216
return nil
You can’t perform that action at this time.
0 commit comments