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.

15 lines
460 B

  1. package state
  2. import (
  3. "github.com/tendermint/tendermint/types"
  4. )
  5. // TxFilter returns a function to filter transactions. The function limits the
  6. // size of a transaction to the maximum block's data size.
  7. func TxFilter(state State) func(tx types.Tx) bool {
  8. maxDataBytes := types.MaxDataBytesUnknownEvidence(
  9. state.ConsensusParams.BlockSize.MaxBytes,
  10. state.Validators.Size(),
  11. )
  12. return func(tx types.Tx) bool { return int64(len(tx)) <= maxDataBytes }
  13. }