vconfig

package
v0.0.0-...-86e039a Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: LGPL-3.0 Imports: 17 Imported by: 0

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(conf *config.VBFTConfig, peers []*config.VBFTPeerStakeInfo, txhash common.Uint256, height uint32) (*ChainConfig, error)

GenesisChainConfig return chainconfig

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

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