mc

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: MIT Imports: 12 Imported by: 218

Documentation

Overview

Copyright (c) 2018-2019 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018-2019 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018-2019 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018-2019 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018-2019 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Index

Constants

View Source
const (
	MSKeyVersionInfo      = "version_info"   // 版本信息
	MSKeyBroadcastTx      = "broad_txs"      // 广播交易
	MSKeyTopologyGraph    = "topology_graph" // 拓扑图
	MSKeyElectGraph       = "elect_graph"    // 选举图
	MSKeyElectOnlineState = "elect_state"    // 选举节点在线信息

	//通用
	MSKeyBroadcastInterval      = "broad_interval"            // 广播区块周期
	MSKeyElectGenTime           = "elect_gen_time"            // 选举生成时间
	MSKeyElectMinerNum          = "elect_miner_num"           // 选举矿工数量
	MSKeyElectConfigInfo        = "elect_details_info"        // 选举配置
	MSKeyElectBlackList         = "elect_black_list"          // 选举黑名单
	MSKeyElectWhiteList         = "elect_white_list"          // 选举白名单
	MSKeyElectWhiteListSwitcher = "elect_white_list_switcher" // 选举白名单生效开关
	MSKeyAccountBroadcasts      = "account_broadcasts"        // 广播账户 []common.Address
	MSKeyAccountInnerMiners     = "account_inner_miners"      // 基金会矿工 []common.Address
	MSKeyAccountFoundation      = "account_foundation"        // 基金会账户 common.Address
	MSKeyAccountVersionSupers   = "account_version_supers"    // 版本签名账户 []common.Address
	MSKeyAccountBlockSupers     = "account_block_supers"      // 超级区块签名账户 []common.Address
	MSKeyAccountMultiCoinSupers = "account_multicoin_supers"  // 超级多币种签名账户 []common.Address
	MSKeyAccountSubChainSupers  = "account_subchain_supers"   // 子链签名账户 []common.Address
	MSKeyVIPConfig              = "vip_config"                // VIP配置信息
	MSKeyPreBroadcastRoot       = "pre_broadcast_Root"        // 前广播区块root信息
	MSKeyLeaderConfig           = "leader_config"             // leader服务配置信息
	MSKeyMinHash                = "pre_100_min_hash"          // 最小hash
	MSKeySuperBlockCfg          = "super_block_config"        // 超级区块配置

	//奖励配置
	MSKeyBlkRewardCfg      = "blk_reward"         // 区块奖励配置
	MSKeyTxsRewardCfg      = "txs_reward"         // 交易奖励配置
	MSKeyInterestCfg       = "interest_reward"    // 利息配置
	MSKeyLotteryCfg        = "lottery_reward"     // 彩票配置
	MSKeySlashCfg          = "slash_reward"       // 惩罚配置
	MSKeyPreMinerBlkReward = "preMiner_blkreward" // 上一矿工区块奖励金额
	MSKeyPreMinerTxsReward = "preMiner_txsreward" // 上一矿工交易奖励金额
	MSKeyUpTimeNum         = "upTime_num"         // upTime状态
	MSKeyLotteryNum        = "lottery_num"        // 彩票状态
	MSKeyLotteryAccount    = "lottery_from"       // 彩票候选账户
	MSKeyInterestCalcNum   = "interest_calc_num"  // 利息计算状态
	MSKeyInterestPayNum    = "interest_pay_num"   // 利息支付状态
	MSKeySlashNum          = "slash_num"          // 惩罚状态
	//奖励算法配置
	MSKeyBlkCalc      = "blk_calc"
	MSKeyTxsCalc      = "txs_calc"
	MSKeyInterestCalc = "interest_calc"
	MSKeyLotteryCalc  = "lottery_calc"
	MSKeySlashCalc    = "slash_calc"

	//未出块选举惩罚配置相关
	MSKeyBlockProduceStatsStatus = "block_produce_stats_status" //
	MSKeyBlockProduceSlashCfg    = "block_produce_slash_cfg"    //
	MSKeyBlockProduceStats       = "block_produce_stats"        //
	MSKeyBlockProduceBlackList   = "block_produce_blacklist"    //

	//交易配置
	MSTxpoolGasLimitCfg = "man_TxpoolGasLimitCfg" //入池gas配置
	MSCurrencyConfig    = "man_CurrencyConfig"    //币种配置
	MSAccountBlackList  = "man_AccountBlackList"  //账户黑名单设置
)
View Source
const (
	Heartbeat   = "Heartbeat"   // 心跳交易(广播区块Hash对99取余)
	Publickey   = "SeedProof"   // 公钥交易
	Privatekey  = "Seed"        // 私钥交易
	CallTheRoll = "CallTheRoll" //点名交易  (广播节点随机连接1000个点)
)

by // 2018-08-18由tx_pool.go转移到此

View Source
const ReelectionTimes = uint64(3) // 选举周期的倍数(广播周期*ReelectionTimes = 选举周期)
View Source
const (
	RewardFullRate = uint64(10000)
)

Variables

View Source
var (
	SubErrorNoThisEvent  = errors.New("SubscribeEvent Failed No This Event")
	PostErrorNoThisEvent = errors.New("PostEvent Failed No This Event")
)

Functions

func PublishEvent

func PublishEvent(aim EventCode, data interface{}) error

func ReturnBroadCastType added in v1.1.1

func ReturnBroadCastType() (bType map[string]bool)

func SubscribeEvent

func SubscribeEvent(aim EventCode, ch interface{}) (event.Subscription, error)

Types

type Alternative

type Alternative struct {
	A        common.Address
	Position uint16
}

type BCIntervalInfo added in v1.1.1

type BCIntervalInfo struct {
	LastBCNumber       uint64 // 最后的广播区块高度
	LastReelectNumber  uint64 // 最后的选举区块高度
	BCInterval         uint64 // 广播周期
	BackupEnableNumber uint64 // 预备广播周期启用高度
	BackupBCInterval   uint64 // 预备广播周期
}

func (*BCIntervalInfo) GetBackupEnableNumber added in v1.1.1

func (info *BCIntervalInfo) GetBackupEnableNumber() uint64

func (*BCIntervalInfo) GetBroadcastInterval added in v1.1.1

func (info *BCIntervalInfo) GetBroadcastInterval() uint64

func (*BCIntervalInfo) GetLastBroadcastNumber added in v1.1.1

func (info *BCIntervalInfo) GetLastBroadcastNumber() uint64

func (*BCIntervalInfo) GetLastReElectionNumber added in v1.1.1

func (info *BCIntervalInfo) GetLastReElectionNumber() uint64

func (*BCIntervalInfo) GetNextBroadcastNumber added in v1.1.1

func (info *BCIntervalInfo) GetNextBroadcastNumber(number uint64) uint64

func (*BCIntervalInfo) GetNextReElectionNumber added in v1.1.1

func (info *BCIntervalInfo) GetNextReElectionNumber(number uint64) uint64

func (*BCIntervalInfo) GetReElectionInterval added in v1.1.1

func (info *BCIntervalInfo) GetReElectionInterval() uint64

func (*BCIntervalInfo) IsBroadcastNumber added in v1.1.1

func (info *BCIntervalInfo) IsBroadcastNumber(number uint64) bool

func (*BCIntervalInfo) IsReElectionNumber added in v1.1.1

func (info *BCIntervalInfo) IsReElectionNumber(number uint64) bool

func (*BCIntervalInfo) SetBackupBCInterval added in v1.1.1

func (info *BCIntervalInfo) SetBackupBCInterval(interval uint64, enableNumber uint64)

func (*BCIntervalInfo) SetLastBCNumber added in v1.1.1

func (info *BCIntervalInfo) SetLastBCNumber(number uint64)

func (*BCIntervalInfo) SetLastReelectNumber added in v1.1.1

func (info *BCIntervalInfo) SetLastReelectNumber(number uint64)

func (*BCIntervalInfo) UsingBackupInterval added in v1.1.1

func (info *BCIntervalInfo) UsingBackupInterval()

type BlkRewardCfg added in v1.1.1

type BlkRewardCfg struct {
	MinerMount               uint64 //矿工奖励单位man
	MinerAttenuationRate     uint16 //矿工衰减比例
	MinerAttenuationNum      uint64 //矿工衰减周期
	ValidatorMount           uint64 //验证者奖励 单位man
	ValidatorAttenuationRate uint16 //验证者衰减比例
	ValidatorAttenuationNum  uint64 //验证者衰减周期
	RewardRate               RewardRateCfg
}

type BlockData

type BlockData struct {
	Header *types.Header
	Txs    []types.CoinSelfTransaction
}

type BlockGenor_BroadcastMiningReqMsg

type BlockGenor_BroadcastMiningReqMsg struct {
	BlockMainData *BlockData
}

type BlockLocalVerifyOK

type BlockLocalVerifyOK struct {
	Header      *types.Header // 包含签名列表的header
	BlockHash   common.Hash
	OriginalTxs []types.CoinSelfTransaction // 原始交易列表
	FinalTxs    []types.CoinSelfTransaction // 最终交易列表(含奖励交易)
	Receipts    []types.CoinReceipts        // 收据
	State       *state.StateDBManage        // apply state changes here 状态数据库
}

type BlockPOSFinishedNotify

type BlockPOSFinishedNotify struct {
	Number        uint64
	Header        *types.Header // 包含签名列表的header
	ConsensusTurn ConsensusTurnInfo
	TxsCode       []*common.RetCallTxN
}

type BlockProduceSlashBlackList added in v1.1.1

type BlockProduceSlashBlackList struct {
	BlackList []UserBlockProduceSlash
}

type BlockProduceSlashCfg added in v1.1.1

type BlockProduceSlashCfg struct {
	Switcher         bool
	LowTHR           uint16
	ProhibitCycleNum uint16
}

type BlockProduceSlashStatsStatus added in v1.1.1

type BlockProduceSlashStatsStatus struct {
	Number uint64
}

type BlockProduceStats added in v1.1.1

type BlockProduceStats struct {
	StatsList []UserBlockProduceNum
}

type BlockToBucket

type BlockToBucket struct {
	Ms     []common.Address
	Height *big.Int
	Role   common.RoleType
}

type BlockToLinker

type BlockToLinker struct {
	Height            *big.Int
	BroadCastInterval *BCIntervalInfo
	Role              common.RoleType
}

type BroadCastEvent

type BroadCastEvent struct {
	Txtyps string
	Height *big.Int
	Data   []byte
}

特殊交易

type Center

type Center struct {
	FeedMap map[EventCode]*event.Feed
}

type ConsensusTurnInfo added in v1.1.1

type ConsensusTurnInfo struct {
	PreConsensusTurn uint32 // 前一次共识轮次
	UsedReelectTurn  uint32 // 完成共识花费的重选轮次
}

func (*ConsensusTurnInfo) Cmp added in v1.1.1

func (info *ConsensusTurnInfo) Cmp(target ConsensusTurnInfo) int64

if < target, return -1 if == target, return 0 if > target, return 1

func (*ConsensusTurnInfo) String added in v1.1.1

func (info *ConsensusTurnInfo) String() string

///////////////////////////////////////////////////////////////////////////////////////////////////

func (*ConsensusTurnInfo) TotalTurns added in v1.1.1

func (info *ConsensusTurnInfo) TotalTurns() uint32

type DepositDetail

type DepositDetail struct {
	Address    common.Address
	NodeID     discover.NodeID
	Deposit    *big.Int
	WithdrawH  *big.Int
	OnlineTime *big.Int
}

拓扑生成模块

type ElectConfigInfo added in v1.1.1

type ElectConfigInfo struct {
	ValidatorNum  uint16
	BackValidator uint16
	ElectPlug     string
}

type ElectConfigInfo_All added in v1.1.1

type ElectConfigInfo_All struct {
	MinerNum          uint16
	ValidatorNum      uint16
	BackValidator     uint16
	ElectPlug         string
	WhiteList         []common.Address
	BlackList         []common.Address
	WhiteListSwitcher bool
}

type ElectGenTimeStruct added in v1.1.1

type ElectGenTimeStruct struct {
	MinerGen           uint16
	MinerNetChange     uint16
	ValidatorGen       uint16
	ValidatorNetChange uint16
	VoteBeforeTime     uint16
}

type ElectGraph added in v1.1.1

type ElectGraph struct {
	Number             uint64
	ElectList          []ElectNodeInfo
	NextMinerElect     []ElectNodeInfo
	NextValidatorElect []ElectNodeInfo
}

func (*ElectGraph) TransferElect2CommonElect added in v1.1.1

func (eg *ElectGraph) TransferElect2CommonElect() []common.Elect

///////////////////////////////////////////////////////////////////////////////////////////////////

func (*ElectGraph) TransferNextElect2CommonElect added in v1.1.1

func (eg *ElectGraph) TransferNextElect2CommonElect() []common.Elect

type ElectMinerNumStruct added in v1.1.1

type ElectMinerNumStruct struct {
	MinerNum uint16
}

type ElectNodeInfo added in v1.1.1

type ElectNodeInfo struct {
	Account  common.Address
	Position uint16
	Stock    uint16
	VIPLevel common.VIPRoleType
	Type     common.RoleType
}

type ElectOnlineStatus added in v1.1.1

type ElectOnlineStatus struct {
	Number      uint64
	ElectOnline []ElectNodeInfo
}

func (*ElectOnlineStatus) FindNodeElectOnlineState added in v1.1.1

func (eos *ElectOnlineStatus) FindNodeElectOnlineState(node common.Address) *ElectNodeInfo

type ElectWhiteListSwitcher added in v1.1.1

type ElectWhiteListSwitcher struct {
	Switcher bool
}

type ElectionEvent

type ElectionEvent struct {
	Seed *big.Int
}

随机数生成响应

type EntrustInfo added in v1.1.1

type EntrustInfo struct {
	Address  string
	Password string
}

type EventCode

type EventCode int
const (
	NewBlockMessage EventCode = iota
	SendBroadCastTx
	HD_MiningReq
	HD_MiningRsp
	HD_BroadcastMiningReq
	HD_BroadcastMiningRsp

	//CA
	CA_RoleUpdated // RoleUpdatedMsg
	CA_ReqCurrentBlock

	//P2P
	P2P_BlkVerifyRequest // BlockVerifyReqMsg

	//Leader service
	Leader_LeaderChangeNotify // LeaderChangeNotify
	Leader_RecoveryState

	//BlockVerify service
	HD_BlkConsensusReq
	HD_BlkConsensusVote
	BlkVerify_VerifyConsensusOK //BlockVerifyConsensusOK
	BlkVerify_POSFinishedNotify //BlockPOSFinishedNotify

	//BlockGenor service
	BlockGenor_HeaderGenerateReq
	HD_NewBlockInsert
	BlockGenor_HeaderVerifyReq
	BlockGenor_NewBlockReady
	HD_FullBlockReq
	HD_FullBlockRsp

	//topnode online
	HD_TopNodeConsensusReq
	HD_TopNodeConsensusVote
	HD_TopNodeConsensusVoteResult

	//leader
	HD_LeaderReelectInquiryReq
	HD_LeaderReelectInquiryRsp
	HD_LeaderReelectReq
	HD_LeaderReelectVote
	HD_LeaderReelectBroadcast
	HD_LeaderReelectBroadcastRsp

	//Topology
	ReElec_MasterMinerReElectionReq
	ReElec_MasterValidatorElectionReq
	Topo_MasterMinerElectionRsp
	Topo_MasterValidatorElectionRsp

	//random
	ReElec_TopoSeedReq
	Random_TopoSeedRsp

	P2P_HDMSG

	BlockToBuckets
	BlockToLinkers
	SendUdpTx
	SendSyncRole //lb
	TxPoolManager

	//1030_scf
	EveryBlockSeedRsp

	LastEventCode
)

type EveryBlockSeedRspMsg added in v1.1.1

type EveryBlockSeedRspMsg struct {
	PublicKey []byte
	Private   []byte
}

type HD_BlkConsensusReqMsg

type HD_BlkConsensusReqMsg struct {
	From                   common.Address
	Header                 *types.Header
	ConsensusTurn          ConsensusTurnInfo
	TxsCode                []*common.RetCallTxN
	OnlineConsensusResults []*HD_OnlineConsensusVoteResultMsg
}

block verify server

func (*HD_BlkConsensusReqMsg) TxsCodeCount added in v1.1.1

func (req *HD_BlkConsensusReqMsg) TxsCodeCount() int

///////////////////////////////////////////////////////////////////////////////////////////////////

type HD_BlockInsertNotify

type HD_BlockInsertNotify struct {
	From   common.Address
	Header *types.Header
}

BolckGenor

type HD_BroadcastMiningRspMsg

type HD_BroadcastMiningRspMsg struct {
	From          common.Address
	BlockMainData *BlockData
}

type HD_ConsensusVote

type HD_ConsensusVote struct {
	SignHash common.Hash
	Number   uint64
	Sign     common.Signature
	From     common.Address
}

共识投票消息

type HD_FullBlockReqMsg

type HD_FullBlockReqMsg struct {
	HeaderHash common.Hash
	Number     uint64
	From       common.Address
}

type HD_FullBlockRspMsg

type HD_FullBlockRspMsg struct {
	Header *types.Header
	Txs    []types.CoinSelfTransaction
	From   common.Address
}

type HD_MiningReqMsg

type HD_MiningReqMsg struct {
	From   common.Address
	Header *types.Header
}

Miner Module

type HD_MiningRspMsg

type HD_MiningRspMsg struct {
	From       common.Address
	Number     uint64
	BlockHash  common.Hash
	Difficulty *big.Int
	Nonce      types.BlockNonce
	Coinbase   common.Address
	MixDigest  common.Hash
	Signatures []common.Signature
}

type HD_OnlineConsensusReqs

type HD_OnlineConsensusReqs struct {
	From    common.Address
	ReqList []*OnlineConsensusReq //请求结构
}

在线状态共识请求消息

type HD_OnlineConsensusVoteResultMsg

type HD_OnlineConsensusVoteResultMsg struct {
	Req      *OnlineConsensusReq //请求结构
	SignList []common.Signature  //签名列表
	From     common.Address
}

共识结果

func (*HD_OnlineConsensusVoteResultMsg) IsValidity added in v1.1.1

func (msg *HD_OnlineConsensusVoteResultMsg) IsValidity(curNumber uint64, validityTime uint64) bool

type HD_OnlineConsensusVotes

type HD_OnlineConsensusVotes struct {
	Votes []HD_ConsensusVote
}

type HD_ReelectBroadcastMsg added in v1.1.1

type HD_ReelectBroadcastMsg struct {
	Number    uint64
	Type      ReelectRSPType
	POSResult *HD_BlkConsensusReqMsg
	RLResult  *HD_ReelectLeaderConsensus
	TimeStamp uint64
	From      common.Address
}

type HD_ReelectBroadcastRspMsg added in v1.1.1

type HD_ReelectBroadcastRspMsg struct {
	Number     uint64
	ResultHash common.Hash
	Sign       common.Signature
	From       common.Address
}

type HD_ReelectInquiryReqMsg

type HD_ReelectInquiryReqMsg struct {
	Number        uint64
	ConsensusTurn ConsensusTurnInfo
	ReelectTurn   uint32
	TimeStamp     uint64
	Master        common.Address
	From          common.Address
}

type HD_ReelectInquiryRspMsg

type HD_ReelectInquiryRspMsg struct {
	Number    uint64
	ReqHash   common.Hash
	Type      ReelectRSPType
	AgreeSign common.Signature
	POSResult *HD_BlkConsensusReqMsg
	RLResult  *HD_ReelectLeaderConsensus
	NewBlock  *types.Header
	From      common.Address
}

type HD_ReelectLeaderConsensus

type HD_ReelectLeaderConsensus struct {
	Req   *HD_ReelectLeaderReqMsg
	Votes []common.Signature
}

type HD_ReelectLeaderReqMsg

type HD_ReelectLeaderReqMsg struct {
	InquiryReq *HD_ReelectInquiryReqMsg
	AgreeSigns []common.Signature
	TimeStamp  uint64
}

type HdRev

type HdRev struct {
	FromNodeId string
	Input      interface{}
}

type InterestCfg added in v1.1.1

type InterestCfg struct {
	RewardMount       uint64 //奖励单位man
	AttenuationRate   uint16 //衰减比例
	AttenuationPeriod uint64 //衰减周期
	PayInterval       uint64
}

type LeaderChangeNotify

type LeaderChangeNotify struct {
	ConsensusState bool //共识结果
	PreLeader      common.Address
	Leader         common.Address
	NextLeader     common.Address
	Number         uint64
	ConsensusTurn  ConsensusTurnInfo
	ReelectTurn    uint32
	TurnBeginTime  int64
	TurnEndTime    int64
}

type LeaderConfig added in v1.1.1

type LeaderConfig struct {
	ParentMiningTime      uint64 // 预留父区块挖矿时间
	PosOutTime            uint64 // 区块POS共识超时时间
	ReelectOutTime        uint64 // 重选超时时间
	ReelectHandleInterval uint64 // 重选处理间隔时间
}

type LeaderStateMsg

type LeaderStateMsg struct {
	Leader      common.Address
	Number      big.Int
	ReelectTurn uint8
}

type LocalBlockVerifyConsensusReq

type LocalBlockVerifyConsensusReq struct {
	BlkVerifyConsensusReq *HD_BlkConsensusReqMsg
	OriginalTxs           []types.CoinSelfTransaction // 原始交易列表
	FinalTxs              []types.CoinSelfTransaction // 最终交易列表(含奖励交易)
	Receipts              []types.CoinReceipts        // 收据
	State                 *state.StateDBManage        // apply state changes here 状态数据库
}

type LotteryCfg added in v1.1.1

type LotteryCfg struct {
	LotteryInfo []LotteryInfo
}

type LotteryFrom added in v1.1.1

type LotteryFrom struct {
	From []common.Address
}

type LotteryInfo added in v1.1.1

type LotteryInfo struct {
	PrizeLevel uint8  //奖励级别
	PrizeNum   uint64 //奖励名额
	PrizeMoney uint64 //奖励金额 单位man
}

type MasterMinerReElectionReqMsg

type MasterMinerReElectionReqMsg struct {
	SeqNum      uint64
	RandSeed    *big.Int
	MinerList   []vm.DepositDetail
	ElectConfig ElectConfigInfo_All
}

矿工主节点生成请求

type MasterMinerReElectionRsp

type MasterMinerReElectionRsp struct {
	SeqNum      uint64
	MasterMiner []ElectNodeInfo
}

矿工主节点生成响应

type MasterMinerReElectionRspMsg

type MasterMinerReElectionRspMsg struct {
	SeqNum uint64
}

Election Module

type MasterValidatorReElectionReqMsg

type MasterValidatorReElectionReqMsg struct {
	SeqNum                  uint64
	RandSeed                *big.Int
	ValidatorList           []vm.DepositDetail
	FoundationValidatorList []vm.DepositDetail
	ElectConfig             ElectConfigInfo_All
	VIPList                 []VIPConfig
	BlockProduceBlackList   BlockProduceSlashBlackList
}

验证者主节点生成请求

type MasterValidatorReElectionRspMsg

type MasterValidatorReElectionRspMsg struct {
	SeqNum uint64
}

type MasterValidatorReElectionRsq

type MasterValidatorReElectionRsq struct {
	SeqNum             uint64
	MasterValidator    []ElectNodeInfo
	BackUpValidator    []ElectNodeInfo
	CandidateValidator []ElectNodeInfo
}

验证者主节点生成响应

type MinerOutReward added in v1.1.1

type MinerOutReward struct {
	Reward big.Int
}

type NewBlockReadyMsg

type NewBlockReadyMsg struct {
	Header *types.Header
	State  *state.StateDBManage
}

type OnlineConsensusReq

type OnlineConsensusReq struct {
	Number      uint64         // 高度
	LeaderTurn  uint32         // leader轮次
	Leader      common.Address // leader地址
	Node        common.Address // node 地址
	OnlineState OnlineState    //在线状态
}

在线状态共识请求

type OnlineState added in v1.1.1

type OnlineState uint8
const (
	OnLine OnlineState = iota + 1
	OffLine
)

func (OnlineState) String added in v1.1.1

func (os OnlineState) String() string

type PreBroadStateRoot added in v1.1.1

type PreBroadStateRoot struct {
	LastStateRoot       []common.CoinRoot
	BeforeLastStateRoot []common.CoinRoot
}

type RandomInfoStruct added in v1.1.1

type RandomInfoStruct struct {
	MinHash  common.Hash
	MaxNonce uint64
}

type RandomRequest

type RandomRequest struct {
	MinHash    common.Hash
	PrivateMap map[common.Address][]byte
	PublicMap  map[common.Address][]byte
}

随机数生成请求

type RecoveryStateMsg

type RecoveryStateMsg struct {
	Type        RecoveryType
	IsBroadcast bool
	Header      *types.Header
	From        common.Address
}

type RecoveryType

type RecoveryType uint8
const (
	RecoveryTypePOS RecoveryType = iota
	RecoveryTypeFullHeader
)

type ReelectRSPType

type ReelectRSPType uint8
const (
	ReelectRSPTypeNone ReelectRSPType = iota
	ReelectRSPTypePOS
	ReelectRSPTypeAlreadyRL
	ReelectRSPTypeAgree
	ReelectRSPTypeNewBlockReady
)

type RewardRateCfg added in v1.1.1

type RewardRateCfg struct {
	MinerOutRate        uint64 //出块矿工奖励
	ElectedMinerRate    uint64 //当选矿工奖励
	FoundationMinerRate uint64 //基金会网络奖励

	LeaderRate              uint64 //出块验证者(leader)奖励
	ElectedValidatorsRate   uint64 //当选验证者奖励
	FoundationValidatorRate uint64 //基金会网络奖励

	OriginElectOfflineRate uint64 //初选下线验证者奖励
	BackupRewardRate       uint64 //当前替补验证者奖励
}

type RoleUpdatedMsg

type RoleUpdatedMsg struct {
	Role         common.RoleType
	BlockNum     uint64
	BlockHash    common.Hash
	Leader       common.Address
	IsSuperBlock bool
}

type SlashCfg added in v1.1.1

type SlashCfg struct {
	SlashRate uint64
}

type SortVIPConfig added in v1.1.1

type SortVIPConfig []VIPConfig

func (SortVIPConfig) Len added in v1.1.1

func (self SortVIPConfig) Len() int

func (SortVIPConfig) Less added in v1.1.1

func (self SortVIPConfig) Less(i, j int) bool

func (SortVIPConfig) Swap added in v1.1.1

func (self SortVIPConfig) Swap(i, j int)

type SuperBlkCfg added in v1.1.1

type SuperBlkCfg struct {
	Seq uint64
	Num uint64
}

type SyncIdEvent added in v1.1.1

type SyncIdEvent struct {
	Role common.RoleType
}

type TopologyGraph

type TopologyGraph struct {
	NodeList      []TopologyNodeInfo
	CurNodeNumber uint8
}

func NewGenesisTopologyGraph

func NewGenesisTopologyGraph(number uint64, netTopology common.NetTopology) (*TopologyGraph, error)

func (*TopologyGraph) AccountIsInGraph added in v1.1.1

func (self *TopologyGraph) AccountIsInGraph(account common.Address) bool

func (*TopologyGraph) CheckAccountRole added in v1.1.1

func (self *TopologyGraph) CheckAccountRole(account common.Address, role common.RoleType) bool

func (*TopologyGraph) FindNextValidator added in v1.1.1

func (self *TopologyGraph) FindNextValidator(account common.Address) common.Address

func (*TopologyGraph) Transfer2NextGraph

func (self *TopologyGraph) Transfer2NextGraph(number uint64, blockTopology *common.NetTopology) (*TopologyGraph, error)

type TopologyNodeInfo

type TopologyNodeInfo struct {
	Account    common.Address
	Position   uint16
	Type       common.RoleType
	NodeNumber uint8 //0-99
}

type TxsRewardCfg added in v1.1.1

type TxsRewardCfg struct {
	MinersRate     uint64 //矿工网络奖励
	ValidatorsRate uint64 //验证者网络奖励
	RewardRate     RewardRateCfg
}

type UserBlockProduceNum added in v1.1.1

type UserBlockProduceNum struct {
	Address    common.Address
	ProduceNum uint16
}

type UserBlockProduceSlash added in v1.1.1

type UserBlockProduceSlash struct {
	Address              common.Address
	ProhibitCycleCounter uint16
}

type VIPConfig added in v1.1.1

type VIPConfig struct {
	MinMoney     uint64
	InterestRate uint64 //(分母待定为1000w)
	ElectUserNum uint8
	StockScale   uint16 //千分比
}

type VrfMsg added in v1.1.1

type VrfMsg struct {
	VrfValue []byte
	VrfProof []byte
	Hash     common.Hash
}

Jump to

Keyboard shortcuts

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