github.com/arcology-network/consensus-engine@v1.9.0/state/tx_filter.go (about)

     1  package state
     2  
     3  import (
     4  	mempl "github.com/arcology-network/consensus-engine/mempool"
     5  	"github.com/arcology-network/consensus-engine/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.MaxDataBytesNoEvidence(
    12  		state.ConsensusParams.Block.MaxBytes,
    13  		state.Validators.Size(),
    14  	)
    15  	return mempl.PreCheckMaxBytes(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  }