vconfig

package
v1.6.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2019 License: LGPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	VRF_SIZE            = 64 // bytes
	MAX_PROPOSER_COUNT  = 32
	MAX_ENDORSER_COUNT  = 240
	MAX_COMMITTER_COUNT = 240
)

Variables

View Source
var NilVRF = VRFValue{}
View Source
var (
	Version uint32 = 1
)

Functions

func GenesisConsensusPayload

func GenesisConsensusPayload(txhash common.Uint256, height uint32) ([]byte, error)

func Pubkey

func Pubkey(nodeid string) (keypair.PublicKey, error)

func PubkeyID

func PubkeyID(pub keypair.PublicKey) string

PubkeyID returns a marshaled representation of the given public key.

func VerifyChainConfig

func VerifyChainConfig(cfg *ChainConfig) error

Types

type ChainConfig

type ChainConfig struct {
	Version              uint32        `json:"version"` // software version
	View                 uint32        `json:"view"`    // config-updated version
	N                    uint32        `json:"n"`       // network size
	C                    uint32        `json:"c"`       // consensus quorum
	BlockMsgDelay        time.Duration `json:"block_msg_delay"`
	HashMsgDelay         time.Duration `json:"hash_msg_delay"`
	PeerHandshakeTimeout time.Duration `json:"peer_handshake_timeout"`
	Peers                []*PeerConfig `json:"peers"`
	PosTable             []uint32      `json:"pos_table"`
	MaxBlockChangeView   uint32        `json:"MaxBlockChangeView"`
}

func GenesisChainConfig

func GenesisChainConfig(config *config.VBFTConfig, peersinfo []*config.VBFTPeerStakeInfo, txhash common.Uint256, height uint32) (*ChainConfig, error)

GenesisChainConfig return chainconfig

func (*ChainConfig) Deserialize

func (cc *ChainConfig) Deserialize(r io.Reader, length int) error

func (*ChainConfig) Hash

func (cc *ChainConfig) Hash() common.Uint256

func (*ChainConfig) Serialize

func (cc *ChainConfig) Serialize(w io.Writer) error

Serialize the ChainConfig

type PeerConfig

type PeerConfig struct {
	Index uint32 `json:"index"`
	ID    string `json:"id"`
}

func (*PeerConfig) Deserialize

func (pc *PeerConfig) Deserialize(r io.Reader) error

func (*PeerConfig) Serialize

func (pc *PeerConfig) Serialize(w io.Writer) error

type VRFValue

type VRFValue [VRF_SIZE]byte

func (VRFValue) Bytes

func (v VRFValue) Bytes() []byte

func (VRFValue) IsNil

func (v VRFValue) IsNil() bool

type VbftBlockInfo

type VbftBlockInfo struct {
	Proposer           uint32       `json:"leader"`
	VrfValue           []byte       `json:"vrf_value"`
	VrfProof           []byte       `json:"vrf_proof"`
	LastConfigBlockNum uint32       `json:"last_config_block_num"`
	NewChainConfig     *ChainConfig `json:"new_chain_config"`
}

VBFT consensus payload, stored on each block header

func VbftBlock added in v1.0.1

func VbftBlock(header *types.Header) (*VbftBlockInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL