Documentation
¶
Index ¶
- Constants
- func GetSelfNodeID() []byte
- func GetSelfNodeKey() *ecdsa.PrivateKey
- func SetSelfNodeKey(key *ecdsa.PrivateKey)
- type CandidateNode
- type DeputyNode
- type DeputyNodes
- type DeputyNodesRecord
- type DeputySalary
- type Manager
- func (d *Manager) Add(height uint32, nodes DeputyNodes)
- func (d *Manager) Clear()
- func (d *Manager) GetDeputiesCount() int
- func (d *Manager) GetDeputyByAddress(height uint32, addr common.Address) *DeputyNode
- func (d *Manager) GetDeputyByNodeID(height uint32, nodeID []byte) *DeputyNode
- func (d *Manager) GetLatestDeputies() []string
- func (d *Manager) GetSlot(height uint32, firstAddress, nextAddress common.Address) int
- func (d *Manager) IsNodeDeputy(height uint32, nodeID []byte) bool
- func (d *Manager) IsSelfDeputyNode(height uint32) bool
- func (d *Manager) TimeToHandOutRewards(height uint32) bool
Constants ¶
View Source
const ( SnapshotBlockInterval = 1000000 TransitionPeriod = 1000 )
Variables ¶
This section is empty.
Functions ¶
func GetSelfNodeID ¶
func GetSelfNodeID() []byte
func GetSelfNodeKey ¶
func GetSelfNodeKey() *ecdsa.PrivateKey
func SetSelfNodeKey ¶
func SetSelfNodeKey(key *ecdsa.PrivateKey)
Types ¶
type CandidateNode ¶ added in v1.1.0
type CandidateNode struct { IsCandidate bool `json:"isCandidate" gencodec:"required"` MinerAddress common.Address `json:"minerAddress" gencodec:"required"` // 候选节点挖矿收益地址 NodeID []byte `json:"nodeID" gencodec:"required"` Host string `json:"host" gencodec:"required"` // ip或者域名 Port uint32 `json:"port" gencodec:"required"` // 端口 }
CandidateNode
func (CandidateNode) MarshalJSON ¶ added in v1.1.0
func (c CandidateNode) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*CandidateNode) UnmarshalJSON ¶ added in v1.1.0
func (c *CandidateNode) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.
type DeputyNode ¶
type DeputyNode struct { MinerAddress common.Address `json:"minerAddress" gencodec:"required"` NodeID []byte `json:"nodeID" gencodec:"required"` IP net.IP `json:"ip" gencodec:"required"` // ip Port uint32 `json:"port" gencodec:"required"` // 端口 Rank uint32 `json:"rank" gencodec:"required"` // 排名 从0开始 Votes *big.Int `json:"votes" gencodec:"required"` // 得票数 }
DeputyNode
func (*DeputyNode) Check ¶
func (d *DeputyNode) Check() error
func (*DeputyNode) Hash ¶
func (d *DeputyNode) Hash() (h common.Hash)
func (DeputyNode) MarshalJSON ¶
func (d DeputyNode) MarshalJSON() ([]byte, error)
MarshalJSON marshals as JSON.
func (*DeputyNode) UnmarshalJSON ¶
func (d *DeputyNode) UnmarshalJSON(input []byte) error
UnmarshalJSON unmarshals from JSON.
type DeputyNodes ¶
type DeputyNodes []*DeputyNode
type DeputyNodesRecord ¶
type DeputyNodesRecord struct {
// contains filtered or unexported fields
}
type DeputySalary ¶
type Manager ¶
type Manager struct { DeputyNodesList []*DeputyNodesRecord // key:节点列表生效开始高度 value:节点列表 // contains filtered or unexported fields }
Manager 代理节点管理器
func (*Manager) Add ¶
func (d *Manager) Add(height uint32, nodes DeputyNodes)
Add 投票结束 统计结果通过add函数缓存起来
func (*Manager) GetDeputiesCount ¶
getDeputyNodeCount 获取共识节点数量
func (*Manager) GetDeputyByAddress ¶
func (d *Manager) GetDeputyByAddress(height uint32, addr common.Address) *DeputyNode
getNodeByAddress 获取address对应的节点
func (*Manager) GetDeputyByNodeID ¶
func (d *Manager) GetDeputyByNodeID(height uint32, nodeID []byte) *DeputyNode
getNodeByNodeID 根据nodeid获取对应的节点
func (*Manager) GetLatestDeputies ¶ added in v1.0.1
func (*Manager) IsNodeDeputy ¶ added in v1.0.2
IsNodeDeputy
func (*Manager) IsSelfDeputyNode ¶
IsSelfDeputyNode
func (*Manager) TimeToHandOutRewards ¶
TimeToHandOutRewards 是否该发出块奖励了
Click to show internal directories.
Click to hide internal directories.