mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-29 06:01:21 +00:00
types/params: introduce EvidenceParams
This commit is contained in:
parent
7d086e9524
commit
48d778c4b3
@ -17,6 +17,7 @@ type ConsensusParams struct {
|
||||
BlockSize `json:"block_size_params"`
|
||||
TxSize `json:"tx_size_params"`
|
||||
BlockGossip `json:"block_gossip_params"`
|
||||
EvidenceParams `json:"evidence_params"`
|
||||
}
|
||||
|
||||
// BlockSize contain limits on the block size.
|
||||
@ -37,12 +38,18 @@ type BlockGossip struct {
|
||||
BlockPartSizeBytes int `json:"block_part_size_bytes"` // NOTE: must not be 0
|
||||
}
|
||||
|
||||
// EvidenceParams determine how we handle evidence of malfeasance
|
||||
type EvidenceParams struct {
|
||||
MaxHeightDiff int `json:"max_height_diff"` // only accept new evidence more recent than this
|
||||
}
|
||||
|
||||
// DefaultConsensusParams returns a default ConsensusParams.
|
||||
func DefaultConsensusParams() *ConsensusParams {
|
||||
return &ConsensusParams{
|
||||
DefaultBlockSize(),
|
||||
DefaultTxSize(),
|
||||
DefaultBlockGossip(),
|
||||
DefaultEvidenceParams(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +77,13 @@ func DefaultBlockGossip() BlockGossip {
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultEvidence Params returns a default EvidenceParams.
|
||||
func DefaultEvidenceParams() EvidenceParams {
|
||||
return EvidenceParams{
|
||||
MaxHeightDiff: 100000, // 27.8 hrs at 1block/s
|
||||
}
|
||||
}
|
||||
|
||||
// Validate validates the ConsensusParams to ensure all values
|
||||
// are within their allowed limits, and returns an error if they are not.
|
||||
func (params *ConsensusParams) Validate() error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user