mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-02 10:02:14 +00:00
* fix amino overhead computation for Tx: - also count the fieldnum / typ3 - add method to compute overhead per Tx - slightly clarify comment on MaxAminoOverheadForBlock - add tests * fix TestReapMaxBytesMaxGas according to amino overhead * fix TestMempoolFilters according to amino overhead * address review comments: - add a note about fieldNum = 1 - add forgotten godoc comment * fix and use sm.TxPreCheck * fix test * remove print statement
23 lines
794 B
Go
23 lines
794 B
Go
package state
|
|
|
|
import (
|
|
mempl "github.com/tendermint/tendermint/mempool"
|
|
"github.com/tendermint/tendermint/types"
|
|
)
|
|
|
|
// TxPreCheck returns a function to filter transactions before processing.
|
|
// The function limits the size of a transaction to the block's maximum data size.
|
|
func TxPreCheck(state State) mempl.PreCheckFunc {
|
|
maxDataBytes := types.MaxDataBytesUnknownEvidence(
|
|
state.ConsensusParams.BlockSize.MaxBytes,
|
|
state.Validators.Size(),
|
|
)
|
|
return mempl.PreCheckAminoMaxBytes(maxDataBytes)
|
|
}
|
|
|
|
// TxPostCheck returns a function to filter transactions after processing.
|
|
// The function limits the gas wanted by a transaction to the block's maximum total gas.
|
|
func TxPostCheck(state State) mempl.PostCheckFunc {
|
|
return mempl.PostCheckMaxGas(state.ConsensusParams.BlockSize.MaxGas)
|
|
}
|