common

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 21 Imported by: 440

Documentation

Overview

Package common contains various helper functions.

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 (
	AlgorithmMsg     = 0x11
	NetworkMsg       = 0x12
	BroadcastReqMsg  = 0x13
	BroadcastRespMsg = 0x14
)
View Source
const (
	RoleNil                RoleType = 0x001
	RoleDefault                     = 0x002
	RoleBucket                      = 0x004
	RoleBackupMiner                 = 0x008
	RoleMiner                       = 0x010
	RoleInnerMiner                  = 0x020
	RoleBackupValidator             = 0x040
	RoleValidator                   = 0x080
	RoleBackupBroadcast             = 0x100
	RoleBroadcast                   = 0x200
	RoleCandidateValidator          = 0x400
	RoleAll                         = 0xFFFF
)
View Source
const (
	HashLength      = 32
	AddressLength   = 20
	SignatureLength = 65
)
View Source
const (
	MainAccount     = iota //主账户
	FreezeAccount          //冻结账户
	LockAccount            //锁仓账户
	WithdrawAccount        //可撤销账户
	EntrustAccount         //委托账户
)
View Source
const (
	PosOffline uint16 = 0xF000
	PosOnline  uint16 = 0xF001
)
View Source
const (
	NetTopoTypeAll    uint8 = 0
	NetTopoTypeChange uint8 = 1
)
View Source
const (
	StateDBRevocableBtree string = "RevcBTree"
	StateDBTimeBtree      string = "TimeBtree"
)
View Source
const (
	ExtraNormalTxType  byte = 0   //普通交易
	ExtraBroadTxType   byte = 1   //广播交易(内部交易,钱包无用)
	ExtraUnGasTxType   byte = 2   //无gas的奖励交易(内部交易,钱包无用)
	ExtraRevocable     byte = 3   //可撤销的交易
	ExtraRevertTxType  byte = 4   //撤销交易
	ExtraAuthTx        byte = 5   //授权委托
	ExtraCancelEntrust byte = 6   //取消委托
	ExtraTimeTxType    byte = 7   //定时交易
	ExtraAItxType      byte = 8   //AI 交易
	ExtraCreatCurrency byte = 118 //创建币种交易
	ExtraSuperTxType   byte = 119 //超级交易
	ExtraSuperBlockTx  byte = 120 //超级区块交易
)
View Source
const (
	RewardNomalType   byte = 0 //奖励通过普通交易发放
	RewardInerestType byte = 1 //利息奖励通过合约交易发放
)

Variables

View Source
var (
	Big1   = big.NewInt(1)
	Big2   = big.NewInt(2)
	Big3   = big.NewInt(3)
	Big0   = big.NewInt(0)
	Big32  = big.NewInt(32)
	Big256 = big.NewInt(256)
	Big257 = big.NewInt(257)
)

Common big integers often used

View Source
var (
	ErrMsgExist       = errors.New("msg already exist")
	ErrMsgNotExist    = errors.New("msg not exist")
	ErrUseMsgTooOften = errors.New("use msg too often, please try later")
)
View Source
var (
	ErrParam = errors.New("param err")
)
View Source
var LastAccount uint32 = EntrustAccount //必须赋值最后一个账户
View Source
var (
	ManValue = new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)
)
View Source
var (
	PutCommit = []CommitContext{
		CommitContext{
			Version:   "Gman_Alg_0.0.1",
			Submitter: "孙春风,胡源凯",
			Commit: []string{
				"修改委托交易下的vrf失败问题",
				"pos参数配置有误",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.2",
			Submitter: "孙春风",
			Commit: []string{
				"出块趋向时间由1改为6",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.3",
			Submitter: "孙春风",
			Commit: []string{
				"删除开发者模式 删除测试网模式 删除rinkeby模式",
				"禁用默认创世文件",
				"委托交易账户外部可见改为man账户",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.4",
			Submitter: "孙春风",
			Commit: []string{
				"换届服务漏合并的代码",
				"顶点在线修改可能panic的问题",
			},
		},
		{
			Version:   "Gman_Alg_0.0.5",
			Submitter: "Ryan",
			Commit: []string{
				"merge nodeId fixed version, modify bucket limit from two to four and modify broadcast block sender",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.6",
			Submitter: "孙春风",
			Commit: []string{
				"提供创世文件默认配置,(用户可选择性的填写创世文件,也可不填)",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.7",
			Submitter: "yeying",
			Commit: []string{
				"修复发送定时交易或者24小时可撤销交易后重启节点导致区块root不一致的问题",
				"修复24小时可撤销交易正常执行完毕后在撤销该笔交易出现崩溃的问题",
				"修复同时发送定时交易和24小时可撤销交易,撤销其中的一笔交易后,转账金额没有减少的问题",
				"修复dump崩溃问题",
				"修改log",
				"deposit bug fixed",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.8",
			Submitter: "zhangwen",
			Commit: []string{
				"参与奖励使用股权收放系数",
				"彩票奖励修改算法",
				"利息奖励使用初选列表获取vip等级",
				"超级区块签名不允许修改,使用本地状态树账户",
				"出块矿工奖励金额在下一块发放",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.9",
			Submitter: "huyuankai",
			Commit: []string{
				"特殊账户状态树key值拆分为独立key值",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.10",
			Submitter: "sunchunfeng",
			Commit: []string{
				"选举算法修改",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.11",
			Submitter: "yeying",
			Commit: []string{
				"uniform gas price (18000000000)",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.12",
			Submitter: "张文",
			Commit: []string{
				"矿工出块奖励使用parenthash取前一块的coinbase,解决选取的矿工不一致的问题",
				"修改二级备份节点会多选一个问题",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.13",
			Submitter: "张文",
			Commit: []string{
				"修改默认创世文件配置",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.14",
			Submitter: "liubo",
			Commit: []string{
				"区块同步fetch增加log部分打印,便于定位问题",
				"去掉ipfs 相关printf打印",
				"ipfs同步频繁启动协程异常判断改为管道方式",
				"去掉高层使用fetch请求区块",
			},
		},
		{
			Version:   "Gman_Alg_0.0.15",
			Submitter: "Ryan",
			Commit: []string{
				"modify the way to create signature file.",
			},
		},
		CommitContext{
			Version:   "Gman_Alg_0.0.16",
			Submitter: "sunyang",
			Commit: []string{
				"增加setVoted方法,标识节点已对某共识请求投过票",
				"在相关投票操作完成之后调用该方法标识该共识请求投票完成",
			},
		},
		{
			Version:   "Gman_Alg_0.0.17",
			Submitter: "Ryan",
			Commit: []string{
				"modify deposit: delete old signature address, reset account after withdraw and refund",
			},
		},
		{
			Version:   "Gman_Alg_0.0.18",
			Submitter: "Ryan",
			Commit: []string{
				"fix peer bug after change identity, fix change nodeId bug",
			},
		},
		{
			Version:   "Gman_Alg_0.0.19",
			Submitter: "liubo",
			Commit: []string{
				"更新linux下终端无法显示log问题",
				"ipfs下载请求修正及偶然的崩溃问题",
			},
		},
		{
			Version:   "Gman_Alg_0.0.20",
			Submitter: "zhangwen",
			Commit: []string{
				"uptime一直累加",
			},
		},
		{
			Version:   "Gman_Alg_0.0.21",
			Submitter: "huyuankai",
			Commit: []string{
				"增加广播节点热备",
				"状态树版本兼容调整",
				"交易码判断错误bug修复",
			},
		},
		{
			Version:   "Gman_Alg_0.0.22",
			Submitter: "zhenghe",
			Commit: []string{
				"修改抵押竞选方式为按角色竞选(勇哥修改)",
			},
		},
		{
			Version:   "Gman_Alg_0.0.23",
			Submitter: "huyuankai",
			Commit: []string{
				"二次秘钥功调整,拓扑图全部使用A0账户",
				"web3接口 获取区块签名列表,返回A0账户",
				"增加拓扑图状态web3接口",
			},
		},
		{
			Version:   "Gman_Alg_0.0.24",
			Submitter: "hemao",
			Commit: []string{
				"未出块惩罚代功能添加",
			},
		},
		{
			Version:   "Gman_Alg_0.0.25",
			Submitter: "zhenghe,liubo",
			Commit: []string{
				"超级交易功能",
				"快照功能合入",
			},
		},
		{
			Version:   "Gman_Alg_0.0.26",
			Submitter: "mehao,huuyankai,zhangwen",
			Commit: []string{
				"创世文件配置及默认创世文件优化",
				"matrix state 改为RLP编码",
				"entrust检查流程代码",
				"共识流程版本兼容",
			},
		},
		{
			Version:   "Gman_Alg_0.0.27",
			Submitter: "zhenghe",
			Commit: []string{
				"download过程按时间委托交易和区块头时间比较",
			},
		},
		{
			Version:   "Gman_Alg_0.0.28",
			Submitter: "zhangwen",
			Commit: []string{
				"解决通过收据获取不到交易的问题",
			},
		},
		{
			Version:   "Gman_Alg_0.0.29",
			Submitter: "zhenghe",
			Commit: []string{
				"修改sendrawtransaction发送方式",
			},
		},
		{
			Version:   "Gman_Alg_0.0.30",
			Submitter: "zhenghe",
			Commit: []string{
				"修改超级交易这是错误类型的币种时panic问题",
				"修改交易相关的日志打印格式",
				"用协程生成快照(yeting)",
			},
		},
		{
			Version:   "Gman_Alg_0.0.31",
			Submitter: "zhangwen",
			Commit: []string{
				"公私钥增加打印",
				"矿工和验证者生成时间点修改支持合约及时生效",
			},
		},
		{
			Version:   "Gman_Alg_0.0.32",
			Submitter: "liubo",
			Commit: []string{
				"ipfs 缓存大小改为设计的年月日约占大小",
				"错误过多时退出ipfs模式",
			},
		},
		{
			Version:   "Gman_Alg_0.0.33",
			Submitter: "zhenghe",
			Commit: []string{
				"修改tcp,udp交易hash不一致问题",
				"修改委托交易失效后不用取消也可以重复委托",
			},
		},
		{
			Version:   "Gman_Alg_0.0.34",
			Submitter: "zhangwen",
			Commit: []string{
				"修复初始交易费奖励账户为0,普通交易gas费不发放奖励的问题",
			},
		},
	}
)
View Source
var (
	SignLog = "SignLog"
)

Functions

func AbsolutePath

func AbsolutePath(Datadir string, filename string) string

func Bytes2Hex

func Bytes2Hex(d []byte) string

func CopyBytes

func CopyBytes(b []byte) (copiedBytes []byte)

Copy bytes

Returns an exact copy of the provided bytes

func EmptyHash

func EmptyHash(h Hash) bool

func FileExist

func FileExist(filePath string) bool

func FromHex

func FromHex(s string) []byte

func GeneratePosition

func GeneratePosition(index uint16, electRole ElectRoleType) uint16

func Greater added in v1.1.1

func Greater(a, b BroadTxkey) bool

func Hex2Bytes

func Hex2Bytes(str string) []byte

func Hex2BytesFixed

func Hex2BytesFixed(str string, flen int) []byte

func IsHexAddress

func IsHexAddress(s string) bool

IsHexAddress verifies whether a string can represent a valid hex-encoded Matrix Address or not.

func IsNil added in v1.1.1

func IsNil(i interface{}) bool

func IsValidityCurrency added in v1.1.1

func IsValidityCurrency(s string) bool

长度为3-8位,不能有小写字母,不能有特殊字符,不能有数字,不能有连续的"MAN"

func IsValidityManCurrency added in v1.1.1

func IsValidityManCurrency(s string) bool

长度为3-8位,不能有小写字母,不能有特殊字符,不能有数字

func LeftPadBytes

func LeftPadBytes(slice []byte, l int) []byte

func Less added in v1.1.1

func Less(a, b BroadTxkey) bool

func LoadJSON

func LoadJSON(file string, val interface{}) error

LoadJSON reads the given file and unmarshals its content.

func MakeName

func MakeName(name, version string) string

MakeName creates a node name that follows the matrix convention for such names. It adds the operation system name and Go runtime version the name.

func PrintDepricationWarning

func PrintDepricationWarning(str string)

PrintDepricationWarning prinst the given string in a box using fmt.Println.

func Report

func Report(extra ...interface{})

Report gives off a warning requesting the user to submit an issue to the github tracker.

func RightPadBytes

func RightPadBytes(slice []byte, l int) []byte

func ToHex

func ToHex(b []byte) string

Types

type AddrAmont added in v1.1.1

type AddrAmont struct {
	Addr  Address
	Amont *big.Int
}

type Address

type Address [AddressLength]byte

Address represents the 20 byte Address of an Matrix account.

var (
	BlkMinerRewardAddress     Address = HexToAddress("0x8000000000000000000000000000000000000000") //区块奖励
	BlkValidatorRewardAddress Address = HexToAddress("0x8000000000000000000000000000000000000001") //leader奖励
	TxGasRewardAddress        Address = HexToAddress("0x8000000000000000000000000000000000000002") //交易费
	LotteryRewardAddress      Address = HexToAddress("0x8000000000000000000000000000000000000003") //彩票
	InterestRewardAddress     Address = HexToAddress("0x8000000000000000000000000000000000000004") //利息
	ContractAddress           Address = HexToAddress("0x000000000000000000000000000000000000000A") //合约账户
)

func BigToAddress

func BigToAddress(b *big.Int) Address

func BytesToAddress

func BytesToAddress(b []byte) Address

func HashToAddress added in v1.1.1

func HashToAddress(hash Hash) Address

func HexToAddress

func HexToAddress(s string) Address

func (Address) Big

func (a Address) Big() *big.Int

func (Address) Bytes

func (a Address) Bytes() []byte

func (Address) Equal

func (a Address) Equal(other Address) bool

func (Address) Format

func (a Address) Format(s fmt.State, c rune)

Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.

func (Address) Hash

func (a Address) Hash() Hash

func (Address) Hex

func (a Address) Hex() string

Hex returns an EIP55-compliant hex string representation of the Address.

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

MarshalText returns the hex representation of a.

func (*Address) Set

func (a *Address) Set(other Address)

Sets a to other

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

Sets the Address to the Value of b. If b is larger than len(a) it will panic

func (*Address) SetString

func (a *Address) SetString(s string)

Set string `s` to a. If s is larger than len(a) it will panic

func (Address) Str

func (a Address) Str() string

Get the string representation of the underlying Address

func (Address) String

func (a Address) String() string

String implements the stringer interface and is used also by the logger.

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a hash in hex syntax.

func (*Address) UnmarshalText

func (a *Address) UnmarshalText(input []byte) error

UnmarshalText parses a hash in hex syntax.

type AuthType added in v1.1.1

type AuthType struct {
	AuthAddres      Address //授权人from
	EnstrustSetType byte    //0-按高度委托,1-按时间委托
	IsEntrustGas    bool    //委托gas
	IsEntrustSign   bool    //委托签名
	StartHeight     uint64  //委托起始高度
	EndHeight       uint64  //委托结束高度
	StartTime       uint64
	EndTime         uint64
}

type BalanceSlice added in v1.1.1

type BalanceSlice struct {
	AccountType uint32
	Balance     *big.Int
}

账户属性定义

type BalanceType added in v1.1.1

type BalanceType []BalanceSlice

type BroadTxSlice added in v1.1.1

type BroadTxSlice []BroadTxValue

func (*BroadTxSlice) FindKey added in v1.1.1

func (si *BroadTxSlice) FindKey(key string) map[Address][]byte

func (*BroadTxSlice) FindValue added in v1.1.1

func (si *BroadTxSlice) FindValue(key string, address Address) ([]byte, bool)

func (*BroadTxSlice) Insert added in v1.1.1

func (si *BroadTxSlice) Insert(key string, address Address, value []byte)

type BroadTxValue added in v1.1.1

type BroadTxValue struct {
	Key   BroadTxkey
	Value []byte
}

type BroadTxkey added in v1.1.1

type BroadTxkey struct {
	Key     string
	Address Address
}

type CommitContext added in v1.1.1

type CommitContext struct {
	Version   string
	Submitter string
	Commit    []string
}

type Echelon added in v1.1.1

type Echelon struct {
	MinMoney *big.Int
	MaxNum   int
	Ratio    uint16
}

type Elect

type Elect struct {
	Account Address
	Stock   uint16
	Type    ElectRoleType
	VIP     VIPRoleType
}

type Elect1 added in v1.1.1

type Elect1 struct {
	Account string
	Stock   uint16
	Type    ElectRoleType
	VIP     VIPRoleType
}

type ElectRoleType

type ElectRoleType uint8
const (
	ElectRoleMiner              ElectRoleType = 0x00
	ElectRoleMinerBackUp        ElectRoleType = 0x01
	ElectRoleValidator          ElectRoleType = 0x02
	ElectRoleValidatorBackUp    ElectRoleType = 0x03
	ElectRoleCandidateValidator ElectRoleType = 0x04
	ElectRoleNil                ElectRoleType = 0xff
)

func (ElectRoleType) Transfer2CommonRole

func (ert ElectRoleType) Transfer2CommonRole() RoleType

type EntrustType added in v1.1.1

type EntrustType struct {
	//委托地址
	EntrustAddres string //被委托人from
	//委托权限
	IsEntrustGas    bool //委托gas
	IsEntrustSign   bool //委托签名
	EnstrustSetType byte //0-按高度委托,1-按时间委托

	//委托限制
	StartHeight uint64 //委托起始高度
	EndHeight   uint64 //委托结束高度
	StartTime   uint64
	EndTime     uint64
}

地址为matrix地址

type Hash

type Hash [HashLength]byte

Hash represents the 32 byte Keccak256 hash of arbitrary data.

func BigToHash

func BigToHash(b *big.Int) Hash

func BytesToHash

func BytesToHash(b []byte) Hash

func HexToHash

func HexToHash(s string) Hash

func (Hash) Big

func (h Hash) Big() *big.Int

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (Hash) Equal

func (h Hash) Equal(other Hash) bool

func (Hash) Format

func (h Hash) Format(s fmt.State, c rune)

Format implements fmt.Formatter, forcing the byte slice to be formatted as is, without going through the stringer interface used for logging.

func (Hash) Generate

func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value

Generate implements testing/quick.Generator.

func (Hash) Hex

func (h Hash) Hex() string

func (Hash) MarshalText

func (h Hash) MarshalText() ([]byte, error)

MarshalText returns the hex representation of h.

func (*Hash) Set

func (h *Hash) Set(other Hash)

Sets h to other

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte)

Sets the hash to the Value of b. If b is larger than len(h), 'b' will be cropped (from the left).

func (*Hash) SetString

func (h *Hash) SetString(s string)

Set string `s` to h. If s is larger than len(h) s will be cropped (from left) to fit.

func (Hash) Str

func (h Hash) Str() string

Get the string representation of the underlying hash

func (Hash) String

func (h Hash) String() string

String implements the stringer interface and is used also by the logger when doing full logging into a file.

func (Hash) TerminalString

func (h Hash) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(input []byte) error

UnmarshalJSON parses a hash in hex syntax.

func (*Hash) UnmarshalText

func (h *Hash) UnmarshalText(input []byte) error

UnmarshalText parses a hash in hex syntax.

type MixedcaseAddress

type MixedcaseAddress struct {
	// contains filtered or unexported fields
}

MixedcaseAddress retains the original string, which may or may not be correctly checksummed

func NewMixedcaseAddress

func NewMixedcaseAddress(addr Address) MixedcaseAddress

NewMixedcaseAddress constructor (mainly for testing)

func NewMixedcaseAddressFromString

func NewMixedcaseAddressFromString(hexaddr string) (*MixedcaseAddress, error)

NewMixedcaseAddressFromString is mainly meant for unit-testing

func (*MixedcaseAddress) Address

func (ma *MixedcaseAddress) Address() Address

Address returns the Address

func (*MixedcaseAddress) MarshalJSON

func (ma *MixedcaseAddress) MarshalJSON() ([]byte, error)

MarshalJSON marshals the original Value

func (*MixedcaseAddress) Original

func (ma *MixedcaseAddress) Original() string

Original returns the mixed-case input string

func (*MixedcaseAddress) String

func (ma *MixedcaseAddress) String() string

String implements fmt.Stringer

func (*MixedcaseAddress) UnmarshalJSON

func (ma *MixedcaseAddress) UnmarshalJSON(input []byte) error

UnmarshalJSON parses MixedcaseAddress

func (*MixedcaseAddress) ValidChecksum

func (ma *MixedcaseAddress) ValidChecksum() bool

ValidChecksum returns true if the Address has valid checksum

type NetTopology

type NetTopology struct {
	Type            uint8
	NetTopologyData []NetTopologyData
}

type NetTopology1 added in v1.1.1

type NetTopology1 struct {
	Type            uint8
	NetTopologyData []NetTopologyData1
}

type NetTopologyData

type NetTopologyData struct {
	Account  Address
	Position uint16
}

type NetTopologyData1 added in v1.1.1

type NetTopologyData1 struct {
	Account  string
	Position uint16
}

type PrettyDuration

type PrettyDuration time.Duration

PrettyDuration is a pretty printed version of a time.Duration value that cuts the unnecessary precision off from the formatted textual representation.

func (PrettyDuration) String

func (d PrettyDuration) String() string

String implements the Stringer interface, allowing pretty printing of duration values rounded to three decimals.

type RecorbleTx added in v1.1.1

type RecorbleTx struct {
	From Address
	Adam []AddrAmont
	Tim  uint32
	Typ  byte
}

type ResendMsgCtrl added in v1.1.1

type ResendMsgCtrl struct {
	// contains filtered or unexported fields
}

func NewResendMsgCtrl added in v1.1.1

func NewResendMsgCtrl(msg interface{}, sendFunc func(interface{}, uint32), interval int64, times uint32) (*ResendMsgCtrl, error)

func (*ResendMsgCtrl) Close added in v1.1.1

func (self *ResendMsgCtrl) Close()

type RetCallTxN added in v1.1.1

type RetCallTxN struct {
	TXt   byte
	ListN []uint32
}

type ReuseMsgController

type ReuseMsgController struct {
	// contains filtered or unexported fields
}

func NewReuseMsgController

func NewReuseMsgController(useInterval int64) *ReuseMsgController

func (ReuseMsgController) AddMsg

func (self ReuseMsgController) AddMsg(msgKey Hash, msg interface{}, lastUseTime int64) error

func (ReuseMsgController) GetMsgByKey

func (self ReuseMsgController) GetMsgByKey(msgKey Hash) interface{}

func (ReuseMsgController) GetMsgList

func (self ReuseMsgController) GetMsgList() []interface{}

func (ReuseMsgController) IsExistMsg

func (self ReuseMsgController) IsExistMsg(msgKey Hash) bool

func (ReuseMsgController) ReUseMsg

func (self ReuseMsgController) ReUseMsg(msgKey Hash) (interface{}, error)

type RewarTx added in v1.1.1

type RewarTx struct {
	CoinType  string
	Fromaddr  Address
	To_Amont  map[Address]*big.Int
	RewardTyp byte
}

type RoleType

type RoleType uint32

RoleType

func GetRoleTypeFromPosition

func GetRoleTypeFromPosition(position uint16) RoleType

func (RoleType) String

func (rt RoleType) String() string

func (RoleType) Transfer2ElectRole added in v1.1.1

func (rt RoleType) Transfer2ElectRole() ElectRoleType

type Signature

type Signature [SignatureLength]byte

///////// Signature

func BytesToSignature

func BytesToSignature(b []byte) Signature

func (Signature) Bytes

func (s Signature) Bytes() []byte

func (Signature) MarshalText added in v1.1.1

func (a Signature) MarshalText() ([]byte, error)
func (a *Signature) MarshalJSON() ([]byte, error) {
	return hexutil.Bytes(a[:]).MarshalText()
}

func (*Signature) Set

func (h *Signature) Set(other Signature)

Sets h to other

func (*Signature) SetBytes

func (s *Signature) SetBytes(b []byte)

func (Signature) Str

func (s Signature) Str() string

func (*Signature) UnmarshalJSON added in v1.1.1

func (a *Signature) UnmarshalJSON(input []byte) error

type StorageSize

type StorageSize float64

StorageSize is a wrapper around a float value that supports user friendly formatting.

func (StorageSize) String

func (s StorageSize) String() string

String implements the stringer interface.

func (StorageSize) TerminalString

func (s StorageSize) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

type TxTypeInt added in v1.1.1

type TxTypeInt uint8

type UnprefixedAddress

type UnprefixedAddress Address

UnprefixedHash allows marshaling an Address without 0x prefix.

func (UnprefixedAddress) MarshalText

func (a UnprefixedAddress) MarshalText() ([]byte, error)

MarshalText encodes the Address as hex.

func (*UnprefixedAddress) UnmarshalText

func (a *UnprefixedAddress) UnmarshalText(input []byte) error

UnmarshalText decodes the Address from hex. The 0x prefix is optional.

type UnprefixedHash

type UnprefixedHash Hash

UnprefixedHash allows marshaling a Hash without 0x prefix.

func (UnprefixedHash) MarshalText

func (h UnprefixedHash) MarshalText() ([]byte, error)

MarshalText encodes the hash as hex.

func (*UnprefixedHash) UnmarshalText

func (h *UnprefixedHash) UnmarshalText(input []byte) error

UnmarshalText decodes the hash from hex. The 0x prefix is optional.

type VIPRoleType added in v1.1.1

type VIPRoleType uint16
const (
	VIP_Nil VIPRoleType = 0
	VIP_1   VIPRoleType = 1
	VIP_2   VIPRoleType = 2
	VIP_3   VIPRoleType = 3
)

func GetVIPLevel added in v1.1.1

func GetVIPLevel(index int) VIPRoleType

type VerifiedSign

type VerifiedSign struct {
	Sign     Signature `json:"sign"`
	Account  Address   `json:"account"`
	Validate bool      `json:"validate"`
	Stock    uint16    `json:"stock"`
}

type VerifiedSign1 added in v1.1.1

type VerifiedSign1 struct {
	Sign     Signature `json:"sign"`
	Account  string    `json:"account"`
	Validate bool      `json:"validate"`
	Stock    uint16    `json:"stock"`
}

Directories

Path Synopsis
Package bitutil implements fast bitwise operations.
Package bitutil implements fast bitwise operations.
Package compiler wraps the Solidity compiler executable (solc).
Package compiler wraps the Solidity compiler executable (solc).
Package hexutil implements hex encoding with 0x prefix.
Package hexutil implements hex encoding with 0x prefix.
Package math provides integer math utilities.
Package math provides integer math utilities.
package mclock is a wrapper for a monotonic clock source
package mclock is a wrapper for a monotonic clock source

Jump to

Keyboard shortcuts

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