Browse Source

Make mempool fail txs with negative gas wanted (#2994)

This is only one part of #2989. We also need to fix the application,
and add rules to consensus to ensure this.
pull/2997/head
Dev Ojha 6 years ago
committed by Ethan Buchman
parent
commit
d5d0d2bd77
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      mempool/mempool.go

+ 4
- 0
mempool/mempool.go View File

@ -108,6 +108,10 @@ func PostCheckMaxGas(maxGas int64) PostCheckFunc {
if maxGas == -1 { if maxGas == -1 {
return nil return nil
} }
if res.GasWanted < 0 {
return fmt.Errorf("gas wanted %d is negative",
res.GasWanted)
}
if res.GasWanted > maxGas { if res.GasWanted > maxGas {
return fmt.Errorf("gas wanted %d is greater than max gas %d", return fmt.Errorf("gas wanted %d is greater than max gas %d",
res.GasWanted, maxGas) res.GasWanted, maxGas)


Loading…
Cancel
Save