Documentation ¶
Index ¶
- Constants
- Variables
- func AllGenesisBlocks() []types.StateBlock
- func BalanceToRaw(b types.Balance, unit string) (types.Balance, error)
- func ChainToken() types.Hash
- func CheckTestMode(flag string) bool
- func GasAddress() types.Address
- func GasBlock() types.StateBlock
- func GasBlockHash() types.Hash
- func GasMintageBlock() types.StateBlock
- func GasMintageHash() types.Hash
- func GasToken() types.Hash
- func GenesisAddress() types.Address
- func GenesisBlock() types.StateBlock
- func GenesisBlockHash() types.Hash
- func GenesisMintageBlock() types.StateBlock
- func GenesisMintageHash() types.Hash
- func GenesisPovBlock() types.PovBlock
- func GenesisPovStateKVs() (keys [][]byte, values [][]byte)
- func GetTestMode() string
- func Go(fn func())
- func IsConfidantNode() bool
- func IsGenesisBlock(block *types.StateBlock) bool
- func IsGenesisPovBlock(block *types.PovBlock) bool
- func IsGenesisToken(hash types.Hash) bool
- func IsNormalNode() bool
- func RawToBalance(b types.Balance, unit string) (types.Balance, error)
- func RawToBalanceFloat(b types.Balance, unit string) (*big.Float, error)
- func SetTestMode(mode string)
- func TimeNow() time.Time
- type Service
- type ServiceLifecycle
- func (s *ServiceLifecycle) PostInit() bool
- func (s *ServiceLifecycle) PostStart() bool
- func (s *ServiceLifecycle) PostStop() bool
- func (s *ServiceLifecycle) PreInit() bool
- func (s *ServiceLifecycle) PreStart() bool
- func (s *ServiceLifecycle) PreStop() bool
- func (s *ServiceLifecycle) State() int32
- func (s *ServiceLifecycle) Stopped() bool
- func (s *ServiceLifecycle) String() string
- type ServiceStatus
- type SyncCacheWalkFunc
- type SyncState
- type TopicType
Constants ¶
View Source
const ( //vote right divisor DposVoteDivisor = int64(200) DPosOnlinePeriod = uint64(120) DPosOnlineRate = uint64(60) DPosHeartCountPerPeriod = DPosOnlinePeriod / 2 DPosOnlineSectionLeft = 30 DPosOnlineSectionRight = 90 )
View Source
const ( SyncCacheUnchecked byte = iota SyncCacheUnconfirmed )
Variables ¶
View Source
var ( //node type NodeType = nodeTypeNormal //DPOS params DPoSMaxBlocks = 102400 DPoSMaxCacheBlocks = 102400 //EventBus params EventBusWaitingQueueSize = 102400 //Badger params BadgerMaxTableSize = int64(64 << 20) //P2P params P2PMsgChanSize = 655350 P2PMsgCacheSize = 51200 P2PMonitorMsgChanSize = 65535 )
View Source
var ( // PoV Block Chain Params PovChainGenesisBlockHeight = uint64(0) PovChainBlockInterval = 60 PovChainTargetCycle = 20 PovChainBlockSize = 2 * 1024 * 1024 PovChainRetargetTimespan = PovChainBlockInterval * PovChainTargetCycle PovChainMinRetargetTimespan = PovChainRetargetTimespan / 4 PovChainMaxRetargetTimespan = PovChainRetargetTimespan * 4 POVChainBlocksPerHour = 3600 / PovChainBlockInterval POVChainBlocksPerDay = POVChainBlocksPerHour * 24 // Miner core parameters PovMinerPledgeAmountMin = types.NewBalance(10000000000000) PovMinerVerifyHeightStart = uint64(POVChainBlocksPerDay * 1) PovMinerRewardHeightStart = uint64(POVChainBlocksPerDay * 3) PovMinerRewardHeightGapToLatest = uint64(POVChainBlocksPerDay * 1) PovMinerMaxRewardBlocksPerCall = uint64(POVChainBlocksPerDay * 7) PovMinerRewardHeightRound = uint64(POVChainBlocksPerDay * 1) PovMinerMaxFindNonceTimeSec = PovChainBlockInterval * PovChainTargetCycle // Reward per block, rewardPerBlock * blockNumPerYear / gasTotalSupply = 3% // 10000000000000000 * 0.03 / (365 * 24 * 60) PovMinerRewardPerDay = uint64(821917808219) PovMinerRewardPerBlock = uint64(570776255) PovMinerRewardPerBlockInt = big.NewInt(int64(PovMinerRewardPerBlock)) PovMinerRewardPerBlockBalance = types.NewBalance(int64(PovMinerRewardPerBlock)) PovMinerMinRewardPerBlock = uint64(570776) // 0.001 * 570776255 PovMinerRewardRatioMiner = 60 // 60% PovMinerRewardRatioRep = 40 // 40% // Bonus per block, bonusPerBlock * blockNumPerYear / stakingRewardPerYear = 90%(max) PovStakingRewardPerDay = uint64(830200000000) PovMinerBonusMaxPerDay = uint64(747180000000) // 830200000000 * 90 / 100 PovMinerBonusPerKiloPerDay = uint64(747180) // 747180000000 / (1G / 1M) PovMinerBonusDiffRatioMax = uint64(1000000000) // 1G PovMinerBonusDiffRatioMin = 1000 // 1K PoVMaxForkHeight = uint64(POVChainBlocksPerHour * 23) PovGenesisPowHex = "00000000ffff0000000000000000000000000000000000000000000000000000" PovGenesisPowInt, _ = new(big.Int).SetString(PovGenesisPowHex, 16) PovGenesisPowBits = types.BigToCompact(PovGenesisPowInt) //0x1d00ffff // PowLimit is the highest proof of work value a Bitcoin block // can have for the test network. PovPowLimitHex = "00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff" PovPowLimitInt, _ = new(big.Int).SetString(PovPowLimitHex, 16) PovPowLimitBits = types.BigToCompact(PovPowLimitInt) //0x1d00ffff // maximum number of seconds a block time is allowed to be ahead of the now time. PovMaxAllowedFutureTimeSec = 300 PovMinCoinbaseExtraSize = 2 PovMaxCoinbaseExtraSize = 100 )
Functions ¶
func AllGenesisBlocks ¶ added in v1.2.3
func AllGenesisBlocks() []types.StateBlock
func BalanceToRaw ¶ added in v0.0.9
func ChainToken ¶ added in v1.0.1
func CheckTestMode ¶ added in v1.3.0
func GasAddress ¶ added in v1.0.4
func GasBlock ¶ added in v1.0.4
func GasBlock() types.StateBlock
func GasBlockHash ¶ added in v1.0.4
func GasMintageBlock ¶ added in v1.0.4
func GasMintageBlock() types.StateBlock
func GasMintageHash ¶ added in v1.0.4
func GenesisAddress ¶ added in v1.0.1
func GenesisBlock ¶ added in v1.0.1
func GenesisBlock() types.StateBlock
func GenesisBlockHash ¶ added in v1.0.1
func GenesisMintageBlock ¶ added in v0.0.9
func GenesisMintageBlock() types.StateBlock
func GenesisMintageHash ¶ added in v0.0.9
func GenesisPovBlock ¶ added in v1.2.3
func GenesisPovStateKVs ¶ added in v1.2.3
func GetTestMode ¶ added in v1.3.0
func GetTestMode() string
func IsConfidantNode ¶ added in v1.2.3
func IsConfidantNode() bool
func IsGenesisBlock ¶ added in v0.0.9
func IsGenesisBlock(block *types.StateBlock) bool
IsGenesis check block is chain token genesis
func IsGenesisPovBlock ¶ added in v1.2.3
func IsGenesisToken ¶ added in v1.0.4
IsGenesis check token is chain token genesis
func IsNormalNode ¶ added in v1.2.3
func IsNormalNode() bool
func RawToBalance ¶ added in v0.0.9
func RawToBalanceFloat ¶ added in v1.2.3
func SetTestMode ¶ added in v1.3.0
func SetTestMode(mode string)
Types ¶
type ServiceLifecycle ¶
type ServiceLifecycle struct {
Status int32 // ServiceStatus
}
func (*ServiceLifecycle) PostInit ¶
func (s *ServiceLifecycle) PostInit() bool
func (*ServiceLifecycle) PostStart ¶
func (s *ServiceLifecycle) PostStart() bool
func (*ServiceLifecycle) PostStop ¶
func (s *ServiceLifecycle) PostStop() bool
func (*ServiceLifecycle) PreInit ¶
func (s *ServiceLifecycle) PreInit() bool
func (*ServiceLifecycle) PreStart ¶
func (s *ServiceLifecycle) PreStart() bool
func (*ServiceLifecycle) PreStop ¶
func (s *ServiceLifecycle) PreStop() bool
func (*ServiceLifecycle) State ¶
func (s *ServiceLifecycle) State() int32
func (*ServiceLifecycle) Stopped ¶
func (s *ServiceLifecycle) Stopped() bool
func (*ServiceLifecycle) String ¶
func (s *ServiceLifecycle) String() string
type ServiceStatus ¶
type ServiceStatus int32
const ( Origin ServiceStatus = iota Initialing Inited Starting Started Stopping Stopped )
func (ServiceStatus) String ¶
func (i ServiceStatus) String() string
type SyncCacheWalkFunc ¶ added in v1.3.0
type SyncState ¶ added in v1.2.3
type SyncState uint
Sync state
func (SyncState) IsSyncExited ¶ added in v1.2.3
type TopicType ¶ added in v1.1.0
type TopicType string
const ( EventPublish TopicType = "publish" EventConfirmReq TopicType = "confirmReq" EventConfirmAck TopicType = "confirmAck" EventSyncBlock TopicType = "syncBlock" EventConfirmedBlock TopicType = "confirmedBlock" EventBroadcast TopicType = "broadcast" EventPeersInfo TopicType = "peersInfo" EventOnlinePeersInfo TopicType = "onlinePeersInfo" EventSyncStatus TopicType = "syncing" EventGetBandwidthStats TopicType = "getBandwidthStats" EventAddRelation TopicType = "addRelation" EventAddSyncBlocks TopicType = "addSyncBlocks" EventDeleteRelation TopicType = "deleteRelation" EventGenerateBlock TopicType = "generateBlock" EventRollback TopicType = "rollback" EventRestartChain TopicType = "restartChain" EventSendMsgToSingle TopicType = "sendMsgToSingle" EventAddP2PStream TopicType = "addP2PStream" EventDeleteP2PStream TopicType = "deleteP2PStream" EventPovPeerStatus TopicType = "povPeerStatus" EventPovRecvBlock TopicType = "povRecvBlock" EventPovBulkPullReq TopicType = "povBulkPullReq" EventPovBulkPullRsp TopicType = "povBulkPullRsp" EventPovSyncState TopicType = "povSyncState" EventPovConnectBestBlock TopicType = "povConnectBestBlock" EventPovDisconnectBestBlock TopicType = "povDisconnectBestBlock" EventRpcSyncCall TopicType = "rpcSyncCall" EventFrontiersReq TopicType = "FrontiersReq" EventFrontierConsensus TopicType = "frontierConsensus" EventFrontierConfirmed TopicType = "frontierConfirmed" EventSyncStateChange TopicType = "syncStateChange" EventConsensusSyncFinished TopicType = "consensusSyncFinished" EventRepresentativeNode TopicType = "representativeNode" EventAddBlockCache TopicType = "addBlockCache" )
Topic type
Source Files ¶
Click to show internal directories.
Click to hide internal directories.