Make mempool aware of MaxGas requirement (#2360)

* Make mempool aware of MaxGas requirement

* update spec

* Add tests

* Switch GasWanted from kv store to persistent kv store

* Fix typo in test name

* switch back to using kvstore, not persistent kv store
This commit is contained in:
Dev Ojha
2018-09-12 13:41:19 -07:00
committed by Ethan Buchman
parent 0e1cd88863
commit 1ea64fc27f
8 changed files with 88 additions and 24 deletions

View File

@ -22,7 +22,7 @@ type Mempool interface {
Size() int
CheckTx(types.Tx, func(*abci.Response)) error
ReapMaxBytes(max int) types.Txs
ReapMaxBytesMaxGas(maxBytes int, maxGas int64) types.Txs
Update(height int64, txs types.Txs, filter func(types.Tx) bool) error
Flush()
FlushAppConn() error
@ -34,11 +34,13 @@ type Mempool interface {
// MockMempool is an empty implementation of a Mempool, useful for testing.
type MockMempool struct{}
var _ Mempool = MockMempool{}
func (MockMempool) Lock() {}
func (MockMempool) Unlock() {}
func (MockMempool) Size() int { return 0 }
func (MockMempool) CheckTx(tx types.Tx, cb func(*abci.Response)) error { return nil }
func (MockMempool) ReapMaxBytes(max int) types.Txs { return types.Txs{} }
func (MockMempool) ReapMaxBytesMaxGas(maxBytes int, maxGas int64) types.Txs { return types.Txs{} }
func (MockMempool) Update(height int64, txs types.Txs, filter func(types.Tx) bool) error { return nil }
func (MockMempool) Flush() {}
func (MockMempool) FlushAppConn() error { return nil }