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.

22 lines
794 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.BlockSize.MaxBytes,
  11. state.Validators.Size(),
  12. )
  13. return mempl.PreCheckAminoMaxBytes(maxDataBytes)
  14. }
  15. // TxPostCheck returns a function to filter transactions after processing.
  16. // The function limits the gas wanted by a transaction to the block's maximum total gas.
  17. func TxPostCheck(state State) mempl.PostCheckFunc {
  18. return mempl.PostCheckMaxGas(state.ConsensusParams.BlockSize.MaxGas)
  19. }