You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
822 B

  1. package state
  2. import (
  3. mempl "github.com/tendermint/tendermint/mempool"
  4. "github.com/tendermint/tendermint/types"
  5. )
  6. // TxPreCheck returns a function to filter transactions before processing.
  7. // The function limits the size of a transaction to the block's maximum data size.
  8. func TxPreCheck(state State) mempl.PreCheckFunc {
  9. maxDataBytes := types.MaxDataBytesUnknownEvidence(
  10. state.ConsensusParams.Block.MaxBytes,
  11. state.Validators.Size(),
  12. state.ConsensusParams.Evidence.MaxNum,
  13. )
  14. return mempl.PreCheckMaxBytes(maxDataBytes)
  15. }
  16. // TxPostCheck returns a function to filter transactions after processing.
  17. // The function limits the gas wanted by a transaction to the block's maximum total gas.
  18. func TxPostCheck(state State) mempl.PostCheckFunc {
  19. return mempl.PostCheckMaxGas(state.ConsensusParams.Block.MaxGas)
  20. }