github.com/devwanda/aphelion-staking@v0.33.9/state/tx_filter.go (about)

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