node_manager

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//status
	CandidateStatus Status = iota
	ConsensusStatus
	QuitingStatus
	BlackStatus

	//function name
	REGISTER_CANDIDATE   = "registerCandidate"
	UNREGISTER_CANDIDATE = "unRegisterCandidate"
	APPROVE_CANDIDATE    = "approveCandidate"
	BLACK_NODE           = "blackNode"
	WHITE_NODE           = "whiteNode"
	QUIT_NODE            = "quitNode"
	UPDATE_CONFIG        = "updateConfig"
	COMMIT_DPOS          = "commitDpos"

	//key prefix
	GOVERNANCE_VIEW = "governanceView"
	VBFT_CONFIG     = "vbftConfig"
	CANDIDITE_INDEX = "candidateIndex"
	PEER_APPLY      = "peerApply"
	PEER_POOL       = "peerPool"
	PEER_INDEX      = "peerIndex"
	BLACK_LIST      = "blackList"
	CONSENSUS_SIGNS = "consensusSigns"

	//const
	MIN_PEER_NUM = 4
)

Variables

This section is empty.

Functions

func ApproveCandidate

func ApproveCandidate(native *native.NativeService) ([]byte, error)

Approve a registered candidate node

func BlackNode

func BlackNode(native *native.NativeService) ([]byte, error)

Put a node into black list, remove node from pool Node in black list can't be registered.

func CheckConsensusSigns

func CheckConsensusSigns(native *native.NativeService, method string, input []byte, address common.Address) (bool, error)

func CheckVBFTConfig

func CheckVBFTConfig(configuration *config.VBFTConfig) error

func CommitDpos

func CommitDpos(native *native.NativeService) ([]byte, error)

Go to next consensus epoch

func GetCurConOperator

func GetCurConOperator(native *native.NativeService) (common.Address, error)

Get current epoch operator derived from current epoch consensus book keepers' public keys

func GetView

func GetView(native *native.NativeService) (uint32, error)

func InitConfig

func InitConfig(native *native.NativeService) ([]byte, error)

Init node_manager contract

func QuitNode

func QuitNode(native *native.NativeService) ([]byte, error)

Quit a registered node, used by node owner. Remove node from pool

func RegisterCandidate

func RegisterCandidate(native *native.NativeService) ([]byte, error)

Register a candidate node, used by users.

func RegisterNodeManagerContract

func RegisterNodeManagerContract(native *native.NativeService)

Register methods of node_manager contract

func UnRegisterCandidate

func UnRegisterCandidate(native *native.NativeService) ([]byte, error)

Unregister a registered candidate node, will remove node from pool

func UpdateConfig

func UpdateConfig(native *native.NativeService) ([]byte, error)

Update VBFT config

func WhiteNode

func WhiteNode(native *native.NativeService) ([]byte, error)

Remove a node from black list, allow it to be registered

Types

type BlackListItem

type BlackListItem struct {
	PeerPubkey string         //peerPubkey in black list
	Address    common.Address //the owner of this peer
}

func (*BlackListItem) Deserialization

func (this *BlackListItem) Deserialization(source *common.ZeroCopySource) error

func (*BlackListItem) Serialization

func (this *BlackListItem) Serialization(sink *common.ZeroCopySink)

type Configuration

type Configuration struct {
	BlockMsgDelay        uint32
	HashMsgDelay         uint32
	PeerHandshakeTimeout uint32
	MaxBlockChangeView   uint32
}

func GetConfig

func GetConfig(native *native.NativeService) (*Configuration, error)

func (*Configuration) Deserialization

func (this *Configuration) Deserialization(source *common.ZeroCopySource) error

func (*Configuration) Serialization

func (this *Configuration) Serialization(sink *common.ZeroCopySink)

type ConsensusSigns

type ConsensusSigns struct {
	SignsMap map[common.Address]bool
}

func (*ConsensusSigns) Deserialization

func (this *ConsensusSigns) Deserialization(source *common.ZeroCopySource) error

func (*ConsensusSigns) Serialization

func (this *ConsensusSigns) Serialization(sink *common.ZeroCopySink)

type GovernanceView

type GovernanceView struct {
	View   uint32
	Height uint32
	TxHash common.Uint256
}

func GetGovernanceView

func GetGovernanceView(native *native.NativeService) (*GovernanceView, error)

func (*GovernanceView) Deserialization

func (this *GovernanceView) Deserialization(source *common.ZeroCopySource) error

func (*GovernanceView) Serialization

func (this *GovernanceView) Serialization(sink *common.ZeroCopySink)

type PeerListParam

type PeerListParam struct {
	PeerPubkeyList []string
	Address        common.Address
}

func (*PeerListParam) Deserialization

func (this *PeerListParam) Deserialization(source *common.ZeroCopySource) error

func (*PeerListParam) Serialization

func (this *PeerListParam) Serialization(sink *common.ZeroCopySink)

type PeerParam

type PeerParam struct {
	PeerPubkey string
	Address    common.Address
}

func (*PeerParam) Deserialization

func (this *PeerParam) Deserialization(source *common.ZeroCopySource) error

func (*PeerParam) Serialization

func (this *PeerParam) Serialization(sink *common.ZeroCopySink)

type PeerPoolItem

type PeerPoolItem struct {
	Index      uint32         //peer index
	PeerPubkey string         //peer pubkey
	Address    common.Address //peer owner
	Status     Status
}

func (*PeerPoolItem) Deserialization

func (this *PeerPoolItem) Deserialization(source *common.ZeroCopySource) error

func (*PeerPoolItem) Serialization

func (this *PeerPoolItem) Serialization(sink *common.ZeroCopySink)

type PeerPoolMap

type PeerPoolMap struct {
	PeerPoolMap map[string]*PeerPoolItem
}

func GetPeerPoolMap

func GetPeerPoolMap(native *native.NativeService, view uint32) (*PeerPoolMap, error)

func (*PeerPoolMap) Deserialization

func (this *PeerPoolMap) Deserialization(source *common.ZeroCopySource) error

func (*PeerPoolMap) Serialization

func (this *PeerPoolMap) Serialization(sink *common.ZeroCopySink)

type RegisterPeerParam

type RegisterPeerParam struct {
	PeerPubkey string
	Address    common.Address
}

func GetPeerApply

func GetPeerApply(native *native.NativeService, peerPubkey string) (*RegisterPeerParam, error)

func (*RegisterPeerParam) Deserialization

func (this *RegisterPeerParam) Deserialization(source *common.ZeroCopySource) error

func (*RegisterPeerParam) Serialization

func (this *RegisterPeerParam) Serialization(sink *common.ZeroCopySink)

type Status

type Status uint8

func (*Status) Deserialization

func (this *Status) Deserialization(source *common.ZeroCopySource) error

func (*Status) Serialization

func (this *Status) Serialization(sink *common.ZeroCopySink)

type UpdateConfigParam

type UpdateConfigParam struct {
	Configuration *Configuration
}

func (*UpdateConfigParam) Deserialization

func (this *UpdateConfigParam) Deserialization(source *common.ZeroCopySource) error

func (*UpdateConfigParam) Serialization

func (this *UpdateConfigParam) Serialization(sink *common.ZeroCopySink)

Jump to

Keyboard shortcuts

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