forked from TrueCloudLab/neoneo-go
transaction: disallow negative outputs
Otherwise it is possible to make outputs which will sum to the expected value, but steal GAS from some other account.
This commit is contained in:
parent
9e9d59b49a
commit
6add4f3e50
1 changed files with 6 additions and 0 deletions
|
@ -100,6 +100,12 @@ func (t *Transaction) DecodeBinary(br *io.BinReader) {
|
||||||
br.ReadArray(&t.Attributes)
|
br.ReadArray(&t.Attributes)
|
||||||
br.ReadArray(&t.Inputs)
|
br.ReadArray(&t.Inputs)
|
||||||
br.ReadArray(&t.Outputs)
|
br.ReadArray(&t.Outputs)
|
||||||
|
for i := range t.Outputs {
|
||||||
|
if t.Outputs[i].Amount.LessThan(0) {
|
||||||
|
br.Err = errors.New("negative output")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
br.ReadArray(&t.Scripts)
|
br.ReadArray(&t.Scripts)
|
||||||
|
|
||||||
// Create the hash of the transaction at decode, so we dont need
|
// Create the hash of the transaction at decode, so we dont need
|
||||||
|
|
Loading…
Reference in a new issue