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
@ -14,9 +14,10 @@ const (
|
|||||||
// ConsensusParams contains consensus critical parameters
|
// ConsensusParams contains consensus critical parameters
|
||||||
// that determine the validity of blocks.
|
// that determine the validity of blocks.
|
||||||
type ConsensusParams struct {
|
type ConsensusParams struct {
|
||||||
BlockSize `json:"block_size_params"`
|
BlockSize `json:"block_size_params"`
|
||||||
TxSize `json:"tx_size_params"`
|
TxSize `json:"tx_size_params"`
|
||||||
BlockGossip `json:"block_gossip_params"`
|
BlockGossip `json:"block_gossip_params"`
|
||||||
|
EvidenceParams `json:"evidence_params"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlockSize contain limits on the block size.
|
// 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
|
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.
|
// DefaultConsensusParams returns a default ConsensusParams.
|
||||||
func DefaultConsensusParams() *ConsensusParams {
|
func DefaultConsensusParams() *ConsensusParams {
|
||||||
return &ConsensusParams{
|
return &ConsensusParams{
|
||||||
DefaultBlockSize(),
|
DefaultBlockSize(),
|
||||||
DefaultTxSize(),
|
DefaultTxSize(),
|
||||||
DefaultBlockGossip(),
|
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
|
// Validate validates the ConsensusParams to ensure all values
|
||||||
// are within their allowed limits, and returns an error if they are not.
|
// are within their allowed limits, and returns an error if they are not.
|
||||||
func (params *ConsensusParams) Validate() error {
|
func (params *ConsensusParams) Validate() error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user