代码拉取完成,页面将自动刷新
package version
import (
"gitee.com/aiou-official/go-aiou/common/config"
)
// ChainIDs
const (
MainNetChainID uint32 = 1024
TestNetChainID uint32 = 1023
)
// ChainConfig ...
type ChainConfig struct {
Block3_0_10 int64
Block3_1_0 int64
Block3_3_0 int64
Block3_3_1 int64
}
var (
mainNetChainConf = &ChainConfig{
Block3_0_10: 12000000,
Block3_1_0: 15800000,
Block3_3_0: 38500000,
Block3_3_1: 53230000,
}
testNetChainConf = &ChainConfig{
Block3_0_10: 10599000,
Block3_1_0: 12800000,
Block3_3_0: 30440000,
Block3_3_1: 45150000,
}
defaultChainConf = &ChainConfig{
Block3_0_10: 0,
Block3_1_0: 0,
Block3_3_0: 0,
Block3_3_1: 0,
}
)
var chainConf = defaultChainConf
// InitChainConf ...
func InitChainConf(conf *config.Config) {
switch conf.P2P.ChainID {
case MainNetChainID:
chainConf = mainNetChainConf
case TestNetChainID:
chainConf = testNetChainConf
default:
chainConf = defaultChainConf
}
}
// IsFork3_3_0 ...
func IsFork3_3_0(num int64) bool {
return isForked(chainConf.Block3_3_0, num)
}
// IsFork3_1_0 ...
func IsFork3_1_0(num int64) bool {
return isForked(chainConf.Block3_1_0, num)
}
// IsFork3_0_10 ...
func IsFork3_0_10(num int64) bool {
return isForked(chainConf.Block3_0_10, num)
}
// IsFork3_3_1 ...
func IsFork3_3_1(num int64) bool {
return isForked(chainConf.Block3_3_1, num)
}
func isForked(v, num int64) bool {
return v <= num
}
// Rules wraps original IsXxx functions
type Rules struct {
IsFork3_0_10 bool `json:"is_fork3_0_10"`
IsFork3_1_0 bool `json:"is_fork3_1_0"`
IsFork3_3_0 bool `json:"is_fork3_3_0"`
IsFork3_3_1 bool `json:"is_fork3_3_1"`
}
// NewRules create Rules for each block
func NewRules(num int64) *Rules {
return &Rules{
IsFork3_0_10: IsFork3_0_10(num),
IsFork3_1_0: IsFork3_1_0(num),
IsFork3_3_0: IsFork3_3_0(num),
IsFork3_3_1: IsFork3_3_1(num),
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。