Documentation
¶
Overview ¶
Package models
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Package models ¶
@author: xwc1125
Index ¶
- Variables
- func RegisterTransaction(txInf interface{})
- func TxEncode(tx Transaction) ([]byte, error)
- type AccountRef
- type AppsStatus
- type Block
- func (b *Block) Block(hash types.Hash) *Block
- func (b *Block) Body() *Body
- func (b *Block) Consensus() *Consensus
- func (b *Block) DecodeRLP(s *rlp.Stream) error
- func (b *Block) EncodeRLP(w io.Writer) error
- func (b *Block) Extra() []byte
- func (b *Block) GasLimit() uint64
- func (b *Block) GasUsed() uint64
- func (b *Block) Hash() types.Hash
- func (b *Block) HashNoSign() types.Hash
- func (b *Block) Header() *Header
- func (b *Block) Height() uint64
- func (b *Block) MarshalJSON() ([]byte, error)
- func (b *Block) Memo() []byte
- func (b *Block) ParentHash() types.Hash
- func (b *Block) SetConsensus(consensus *Consensus)
- func (b *Block) SetStateRoots(stateRoots []byte)
- func (b *Block) SetTransactions(transactions Transactions)
- func (b *Block) Signature() *signature.SignResult
- func (b *Block) Size() types.StorageSize
- func (b *Block) StateRoots() []byte
- func (b *Block) SubBlockCount() uint64
- func (b *Block) SubBlockIndex() uint64
- func (b *Block) SubBlockRoot() types.Hash
- func (b *Block) SubBlocks() *Blocks
- func (b *Block) Timestamp() uint64
- func (b *Block) Transaction(hash types.Hash) Transaction
- func (b *Block) Transactions() Transactions
- func (b *Block) TxsCount() uint64
- func (b *Block) TxsRoot() []types.Hash
- func (b *Block) UnmarshalJSON(input []byte) error
- func (b *Block) WithSeal(header *Header) *Block
- type BlockAbstract
- type BlockchainLocalConfig
- type Blocks
- func (bs *Blocks) BlocksRoot() types.Hash
- func (bs *Blocks) Data() []*Block
- func (bs *Blocks) DecodeRLP(s *rlp.Stream) error
- func (bs *Blocks) DeepCopy() *Blocks
- func (bs *Blocks) EncodeRLP(w io.Writer) error
- func (bs *Blocks) Get(i int) *Block
- func (bs *Blocks) Hashes() []string
- func (bs *Blocks) Item(i int) []byte
- func (bs *Blocks) Key(i int) []byte
- func (bs *Blocks) Len() int
- func (bs *Blocks) Less(i, j int) bool
- func (bs *Blocks) Swap(i, j int)
- type Body
- type BroadcasterLocalConfig
- type ChainConfig
- type Consensus
- type ConsensusConfig
- type ConsensusHandler
- type ConsensusLocalConfig
- type DatabaseConfig
- type Genesis
- type GenesisAccountAlloc
- type GenesisAddress
- type GenesisAddressAlloc
- type GenesisBlock
- type GenesisExtra
- type HandshakeMsg
- type Header
- type LocalConfig
- type Message
- func (m Message) CheckNonce() bool
- func (m Message) From() string
- func (m Message) GasLimit() uint64
- func (m Message) GasPrice() *big.Int
- func (m Message) Input() []byte
- func (m *Message) MarshalJSON() ([]byte, error)
- func (m Message) Nonce() uint64
- func (m Message) SetPrice(gasPrice *big.Int)
- func (m Message) SetValue(value *big.Int)
- func (m Message) To() string
- func (m *Message) UnmarshalJSON(input []byte) error
- func (m Message) Value() *big.Int
- type MsgReadWriter
- type MsgReader
- type MsgWriter
- type NodeID
- type NodeKeyLocalConfig
- type P2PConfig
- type P2PID
- type P2PInfo
- type P2PMessage
- type P2PType
- type PackerConfig
- type PackerLocalConfig
- type StateAppConfig
- type StateTransaction
- type SyncingStatus
- type Transaction
- type TransactionSortedList
- func (txList TransactionSortedList) Hashes() []types.Hash
- func (txList TransactionSortedList) Item(i int) []byte
- func (txList TransactionSortedList) Key(i int) []byte
- func (txList TransactionSortedList) Len() int
- func (txList TransactionSortedList) Less(i, j int) bool
- func (txList TransactionSortedList) Swap(i, j int)
- type Transactions
- func (txs Transactions) Add(tx Transaction)
- func (txs Transactions) AllLen() int
- func (txs Transactions) Data() []TransactionSortedList
- func (txs *Transactions) DecodeRLP(s *rlp.Stream) error
- func (txs Transactions) DeepCopy() Transactions
- func (txs Transactions) EncodeRLP(w io.Writer) error
- func (txs Transactions) GetTx(txType types.TxType, i uint) Transaction
- func (txs Transactions) Hashes() map[types.TxType][]types.Hash
- func (txs Transactions) Len() int
- func (txs Transactions) Less(i, j int) bool
- func (txs Transactions) Print() string
- func (txs Transactions) Swap(i, j int)
- func (txs Transactions) TxsRoot() []types.Hash
- type TxPoolLocalConfig
- type TxStatus
- type TxsStatus
- type VmMessage
- type WorkerType
Constants ¶
This section is empty.
Variables ¶
var TxStatus_name = map[uint32]string{
0: "Unkown",
1: "Failed",
2: "Succeeded",
3: "Waiting",
4: "Pending",
}
var TxStatus_value = map[string]uint32{
"Unkown": 0,
"Failed": 1,
"Succeeded": 2,
"Waiting": 3,
"Pending": 4,
}
Functions ¶
Types ¶
type AccountRef ¶
AccountRef 合约对象
type AppsStatus ¶
type AppsStatus []TxsStatus
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block 区块
func NewBlock ¶
func NewBlock(header *Header, txs Transactions, subBlocks *Blocks) *Block
NewBlock 创建一个新的block。传入的数据都是通过深度copy进行赋值。 外部对header,txs进行修改不会影响到block block未被签名,需要进行签名
func (*Block) MarshalJSON ¶
func (*Block) ParentHash ¶
func (*Block) SetConsensus ¶
func (*Block) SetStateRoots ¶
func (*Block) SetTransactions ¶
func (b *Block) SetTransactions(transactions Transactions)
func (*Block) Signature ¶
func (b *Block) Signature() *signature.SignResult
func (*Block) Size ¶
func (b *Block) Size() types.StorageSize
func (*Block) StateRoots ¶
func (*Block) SubBlockCount ¶
func (*Block) SubBlockIndex ¶
func (*Block) SubBlockRoot ¶
func (*Block) Transaction ¶
func (b *Block) Transaction(hash types.Hash) Transaction
Transaction 根据hash从block的交易中获取交易对象
func (*Block) Transactions ¶
func (b *Block) Transactions() Transactions
func (*Block) UnmarshalJSON ¶
type BlockAbstract ¶
BlockAbstract 区块的摘要
type BlockchainLocalConfig ¶
type BlockchainLocalConfig struct {
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
BlockchainLocalConfig blockchain配置
func (BlockchainLocalConfig) IsMetrics ¶
func (c BlockchainLocalConfig) IsMetrics(_metricsLevel uint64) bool
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
Blocks 交易集合
func (*Blocks) BlocksRoot ¶
type Body ¶
type Body struct {
Height uint64 `json:"height"` // 区块高度
Txs Transactions `json:"transactions"` // 交易集合
}
Body 区块交易集合[可变的、不安全的]
type BroadcasterLocalConfig ¶
type BroadcasterLocalConfig struct {
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
BroadcasterLocalConfig 广播的配置
func (BroadcasterLocalConfig) IsMetrics ¶
func (c BroadcasterLocalConfig) IsMetrics(_metricsLevel uint64) bool
type ChainConfig ¶
type ChainConfig struct {
ChainID uint64 `json:"chain_id" mapstructure:"chain_id"` // 链ID
ChainName string `json:"chain_name" mapstructure:"chain_name"` // 链名称,Chain5j
VersionName string `json:"version_name" mapstructure:"version_name"` // 版本名称,v1.0.0
VersionCode uint64 `json:"version_code" mapstructure:"version_code"` // 版本code,1
GenesisHeight uint64 `json:"genesis_height" mapstructure:"genesis_height"` // 创世高度
TxSizeLimit uint64 `json:"tx_size_limit" mapstructure:"tx_size_limit"` // 单笔交易最大限制 单位 KB
Packer *PackerConfig `json:"packer" mapstructure:"packer" rlp:"nil"` // 打包逻辑处理
// TODO 【xwc1125】需要将共识配置设置成map的方式。在每个共识内部自己去解析
Consensus *ConsensusConfig `json:"consensus,omitempty" mapstructure:"consensus" rlp:"nil"`
StateApp *StateAppConfig `json:"state_app,omitempty" mapstructure:"state_app" rlp:"nil"`
}
ChainConfig 链配置
type Consensus ¶
type Consensus struct {
Name string `json:"name,omitempty"` // 共识名称
Consensus []byte `json:"consensus,omitempty" rlp:"tail"` // 共识内容
}
Consensus 共识信息
func (*Consensus) MarshalJSON ¶
func (*Consensus) UnmarshalJSON ¶
type ConsensusConfig ¶
type ConsensusConfig struct {
Name string `json:"name,omitempty"` // 共识名称
Data *hashmap.HashMap `json:"consensus,omitempty"` // 共识具体配置
}
func (*ConsensusConfig) ToConsensus ¶
func (c *ConsensusConfig) ToConsensus() (*Consensus, error)
type ConsensusHandler ¶
type ConsensusLocalConfig ¶
type ConsensusLocalConfig struct {
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
ConsensusLocalConfig consensus配置
func (ConsensusLocalConfig) IsMetrics ¶
func (c ConsensusLocalConfig) IsMetrics(_metricsLevel uint64) bool
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string `json:"driver" mapstructure:"driver"` // 驱动类型
Source string `json:"source" mapstructure:"source"` // 资源
Username string `json:"username" mapstructure:"username"` // 用户名
Password string `json:"password" mapstructure:"password"` // 密码
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
func (DatabaseConfig) IsMetrics ¶
func (c DatabaseConfig) IsMetrics(_metricsLevel uint64) bool
type Genesis ¶
type Genesis struct {
ChainConfig *ChainConfig `json:"config" mapstructure:"config"` // 链配置
ConsensusConfig *ConsensusConfig `json:"consensus_config,omitempty" mapstructure:"consensus_config"` // 共识配置
GenesisBlock *GenesisBlock `json:"genesis_block,omitempty" mapstructure:"genesis_block"` // 创世区块
AccountAlloc GenesisAccountAlloc `json:"account_alloc,omitempty" mapstructure:"account_alloc"` // 账户配置
AddressAlloc GenesisAddressAlloc `json:"address_alloc,omitempty" mapstructure:"address_alloc"` // 地址配置
}
Genesis 创世文件内容,此文件用于生成genesis.json 在进行sign_genesis时,需要将ConsensusConfig转换为chainConfig中的Consensus 将GenesisBlock转换为chainConfig中的GenesisBlock 将AccountAlloc,AddressAlloc转换为txs
type GenesisAccountAlloc ¶
type GenesisAccountAlloc map[string]accounts.AccountStore
GenesisAccountAlloc account ==> accounts.AccountStore
type GenesisAddress ¶
type GenesisAddress struct {
Code *hexutil.Bytes `json:"code,omitempty" mapstructure:"code"` // code
Storage map[types.Hash]types.Hash `json:"storage,omitempty" mapstructure:"storage"` // 存储
Balance *big.Int `json:"balance,omitempty" mapstructure:"balance"` // 余额
Nonce uint64 `json:"nonce,omitempty" mapstructure:"nonce"` // nonce
}
GenesisAddress 创世地址信息
type GenesisAddressAlloc ¶
type GenesisAddressAlloc map[types.Address]GenesisAddress
GenesisAddressAlloc address ==> GenesisAddress
type GenesisBlock ¶
type GenesisBlock struct {
ParentHash types.Hash `json:"parent_hash,omitempty"`
Height uint64 `json:"height,omitempty"`
StateRoots hexutil.Bytes `json:"state_roots,omitempty"`
TxsRoot []types.Hash `json:"txs_root,omitempty"`
TxsCount uint64 `json:"txs_count,omitempty"`
Timestamp uint64 `json:"timestamp,omitempty"`
GasUsed uint64 `json:"gas_used,omitempty"`
GasLimit uint64 `json:"gas_limit,omitempty"`
Consensus *Consensus `json:"consensus,omitempty"`
ArchiveHash *types.Hash `json:"archive_hash,omitempty"`
ReceiptsRoot []types.Hash `json:"receipts_root,omitempty"` // 交易收据的hash
LogsBloom *statetype.Bloom `json:"logs_bloom,omitempty"` // logs的bloom
Extra hexutil.Bytes `json:"extra,omitempty"`
Signature *crypto2.SignResult `json:"signature,omitempty"`
}
GenesisBlock 创世文件中区块的配置
type GenesisExtra ¶
type GenesisExtra struct {
RawExtra []byte `json:"raw_extra"` // 原始扩展内容
GenesisBytes []byte `json:"genesis_bytes"` // 创世文件内容
}
GenesisExtra 创世区块的扩展内容。此内容在创世块中,填充区块的Extra
type HandshakeMsg ¶
type HandshakeMsg struct {
Peer P2PID `json:"peer" rlp:"-"` // 节点ID
ProtocolVersion uint32 `json:"protocol_version"` // 协议版本
NetworkId uint64 `json:"network_id"` // 网络ID
CurrentBlockHash types.Hash `json:"current_block_hash"` // 当前区块hash
CurrentBlockHeight uint64 `json:"current_block_height"` // 当前区块高度
GenesisBlockHash types.Hash `json:"genesis_block_hash"` // 创世块hash
}
HandshakeMsg 握手消息
type Header ¶
type Header struct {
ParentHash types.Hash `json:"parent_hash"` // 父Hash
Height uint64 `json:"height"` // 区块高度
Timestamp uint64 `json:"timestamp"` // 区块时间戳[毫秒]
StateRoots []byte `json:"state_roots"` // 状态根
// 子区块内容
SubBlockIndex uint64 `json:"sub_block_index"` // 子区块顺序
SubBlockRoot types.Hash `json:"sub_block_root,omitempty"` // 子区块根
SubBlockCount uint64 `json:"sub_block_count,omitempty"` // 子区块个数
// 交易内容
TxsRoot []types.Hash `json:"txs_root"` // 交易树根数组(多种交易类型,存在多种交易根)
TxsCount uint64 `json:"txs_count"` // 交易个数
ReceiptsRoot []types.Hash `json:"receipts_root,omitempty"` // 交易收据根
LogsBloom *statetype.Bloom `json:"logs_bloom,omitempty" rlp:"nil"` // logs的bloom
// gas消耗内容
GasUsed uint64 `json:"gas_used"` // 总的区块消耗gas
GasLimit uint64 `json:"gas_limit"` // 区块最大gas
Consensus *Consensus `json:"consensus,omitempty" rlp:"nil"` // 共识内容
ArchiveHash *types.Hash `json:"archive_hash,omitempty" rlp:"nil"` // 区块归档区块hash
Extra []byte `json:"extra,omitempty"` // 扩展内容
Memo []byte `json:"memo,omitempty"` // 备忘录
Signature *signature.SignResult `json:"signature" rlp:"nil"` // 签名数据
}
Header 区块header
func (*Header) UnmarshalJSON ¶
UnmarshalJSON json反序列化
type LocalConfig ¶
type LocalConfig struct {
Log logger.LogConfig `json:"log" mapstructure:"log"` // 日志配置
Database DatabaseConfig `json:"database" mapstructure:"database"` // database配置
Blockchain BlockchainLocalConfig `json:"blockchain" mapstructure:"blockchain"` // blockchain配置
Packer PackerLocalConfig `json:"packer" mapstructure:"packer"` // packer配置
TxPool TxPoolLocalConfig `json:"tx_pool" mapstructure:"tx_pool"` // 交易池配置
NodeKey NodeKeyLocalConfig `json:"node_key" mapstructure:"node_key"` // nodekey模块配置
Broadcaster BroadcasterLocalConfig `json:"broadcaster" mapstructure:"broadcaster"` // broadcaster模块配置
P2P P2PConfig `json:"p2p" mapstructure:"p2p"` // p2p模块配置
Consensus ConsensusLocalConfig `json:"consensus" mapstructure:"consensus"` // consensus模块配置
}
LocalConfig 节点启动本地配置
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func NewEvmMessage ¶
func (Message) CheckNonce ¶
func (*Message) MarshalJSON ¶
func (*Message) UnmarshalJSON ¶
type MsgWriter ¶
type MsgWriter interface {
// WriteMsg 发送消息是堵塞的,必须对方已消费。[消息只能发送一次]
WriteMsg(msg *P2PMessage) error
}
MsgWriter 消息写
type NodeKeyLocalConfig ¶
type NodeKeyLocalConfig struct {
// 节点私钥模块参数属性定义
FileType string `json:"file_type" mapstructure:"file_type"` // 文件类型
PrvKeyFile string `json:"prv_key_file" mapstructure:"prv_key_file"` // 私钥文件
PubKeyFile string `json:"pub_key_file" mapstructure:"pub_key_file"` // 公钥文件
Password string `json:"password" mapstructure:"password"` // 密码
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
NodeKeyLocalConfig nodeKey模块参数配置
func (NodeKeyLocalConfig) IsMetrics ¶
func (c NodeKeyLocalConfig) IsMetrics(_metricsLevel uint64) bool
type P2PConfig ¶
type P2PConfig struct {
Host string `json:"host" mapstructure:"host"` // host
Port int `json:"port" mapstructure:"port"` // 端口号
KeyPath string `json:"key_path" mapstructure:"key_path"` // 私钥路径
CertPath string `json:"cert_path" mapstructure:"cert_path"` // 证书路径
IsTls bool `json:"is_tls" mapstructure:"is_tls"` // 安全P2P
EnablePermission bool `json:"enable_permission" mapstructure:"enable_permission"` // 权限校验
MaxPeers int32 `json:"max_peers" mapstructure:"max_peers"` // 最大peer个数
StaticNodes []string `json:"static_nodes" mapstructure:"static_nodes"` // 静态节点.peerID-->p2p.ID
CaRoots []string `json:"ca_roots" mapstructure:"ca_roots"` // Ca证书
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
P2PConfig p2p配置
type P2PInfo ¶
type P2PInfo struct {
Id P2PID `json:"id"` // 节点ID
NetUrl string `json:"net_url"` // 网络url
Connected bool `json:"connected"` // 是否连接
}
P2PInfo 节点信息
type P2PMessage ¶
type P2PMessage struct {
Type uint `json:"type"` // 类型
Peer P2PID `json:"peer"` // 节点ID
Data []byte `json:"data"` // 数据
}
P2PMessage P2P消息
type PackerConfig ¶
type PackerConfig struct {
WorkerType WorkerType `json:"worker_type" mapstructure:"worker_type"` // 出块类型
BlockMaxTxsCapacity uint64 `json:"block_max_txs_capacity" mapstructure:"block_max_txs_capacity"` // 每个区块的交易最大个数
BlockMaxSize uint64 `json:"block_max_size" mapstructure:"block_max_size"` // 区块最大size(kb)
BlockMaxIntervalTime uint64 `json:"block_max_interval_time" mapstructure:"block_max_interval_time"` // 最大出块间隔(ms)[=0时,采用交易触发]
BlockGasLimit uint64 `json:"block_gas_limit" mapstructure:"block_gas_limit"` // 区块的最大gas
Period uint64 `json:"period" mapstructure:"period"` // 定时出块(=0时,采用交易触发)【毫秒】
EmptyBlocks uint64 `json:"empty_blocks" mapstructure:"empty_blocks"` // 空块的个数
Timeout uint64 `json:"timeout" mapstructure:"timeout"` // 超时时间【毫秒】
MatchTxsCapacity bool `json:"match_txs_capacity" yaml:"match_txs_capacity"` // 是否满足最大txs才开始打包
}
PackerConfig 打包器的配置
type PackerLocalConfig ¶
type PackerLocalConfig struct {
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
PackerLocalConfig 打包器配置
func (PackerLocalConfig) IsMetrics ¶
func (c PackerLocalConfig) IsMetrics(_metricsLevel uint64) bool
type StateAppConfig ¶
type StateAppConfig struct {
UseEthereum bool `json:"use_eth"` // 是否使用eth
}
StateAppConfig 状态应用配置
type StateTransaction ¶
type StateTransaction interface {
Transaction
From() string // 发送者
To() string // 接收者
GasLimit() uint64 // gasLimit
Value() *big.Int // value
Input() []byte // 合约请求的数据
GasPrice() uint64 // gasPrice
Nonce() uint64 // 唯一码
Signer() (types.Address, error) // 签名者
Cost() *big.Int // 预估balance消耗
}
StateTransaction 状态交易
type SyncingStatus ¶
type SyncingStatus struct {
IsSync bool `json:"is_sync"` // true:同步中,false:未同步
StartingBlock *hexutil.Big `json:"starting_block"` // 开始块
CurrentBlock *hexutil.Big `json:"current_block"` // 当前块
HighestBlock *hexutil.Big `json:"highest_block"` // 目标最高块
}
SyncingStatus 同步状态
type Transaction ¶
type Transaction interface {
TxType() types.TxType // 交易类型
ChainId() string // 链ID
Hash() types.Hash // 交易Hash
Less(tx2 Transaction) bool // 是否小于tx2.用于交易排序
Size() types.StorageSize // 交易大小
codec.Serializer // 交易序列化
codec.Deserializer // 交易反序列化
}
Transaction 交易接口
func NewTransaction ¶
func NewTransaction(t types.TxType) (Transaction, error)
NewTransaction 创建一个新的交易对象
type TransactionSortedList ¶
type TransactionSortedList []Transaction
TransactionSortedList nonce递增排序,price递减排序
func NewTransactionSortedList ¶
func NewTransactionSortedList(txs []Transaction) TransactionSortedList
func (TransactionSortedList) Hashes ¶
func (txList TransactionSortedList) Hashes() []types.Hash
func (TransactionSortedList) Item ¶
func (txList TransactionSortedList) Item(i int) []byte
func (TransactionSortedList) Key ¶
func (txList TransactionSortedList) Key(i int) []byte
func (TransactionSortedList) Len ¶
func (txList TransactionSortedList) Len() int
func (TransactionSortedList) Less ¶
func (txList TransactionSortedList) Less(i, j int) bool
func (TransactionSortedList) Swap ¶
func (txList TransactionSortedList) Swap(i, j int)
type Transactions ¶
type Transactions []TransactionSortedList
Transactions 交易集合
func NewTransactions ¶
func NewTransactions(txs []TransactionSortedList) Transactions
NewTransactions 创建一个新的交易集合
func (Transactions) AllLen ¶
func (txs Transactions) AllLen() int
func (*Transactions) DecodeRLP ¶
func (txs *Transactions) DecodeRLP(s *rlp.Stream) error
DecodeRLP rlp解码
func (Transactions) EncodeRLP ¶
func (txs Transactions) EncodeRLP(w io.Writer) error
EncodeRLP rlp编码
func (Transactions) GetTx ¶
func (txs Transactions) GetTx(txType types.TxType, i uint) Transaction
GetTx 获取交易集合中指定位置的交易
func (Transactions) Hashes ¶
func (txs Transactions) Hashes() map[types.TxType][]types.Hash
Hashes 交易集合的hash集
func (Transactions) Len ¶
func (txs Transactions) Len() int
func (Transactions) Less ¶
func (txs Transactions) Less(i, j int) bool
func (Transactions) Print ¶
func (txs Transactions) Print() string
func (Transactions) Swap ¶
func (txs Transactions) Swap(i, j int)
type TxPoolLocalConfig ¶
type TxPoolLocalConfig struct {
Capacity uint64 `json:"capacity" mapstructure:"capacity"` // 交易池的容量
CacheDir string `json:"cache_dir" mapstructure:"cache_dir"` // 交易池的持久化目录
Metrics bool `json:"metrics" mapstructure:"metrics"` // 是否显示指标
MetricsLevel uint64 `json:"metrics_level" mapstructure:"metrics_level"` // 指标级别
}
TxPoolLocalConfig 交易池配置
func (TxPoolLocalConfig) IsMetrics ¶
func (c TxPoolLocalConfig) IsMetrics(_metricsLevel uint64) bool
type TxsStatus ¶
type TxsStatus struct {
TxType types.TxType `json:"tx_type"`
StateRoots []byte `json:"state_roots"`
GasUsed uint64 `json:"gas_used"`
OkTxs TransactionSortedList `json:"ok_txs"`
ErrTxs TransactionSortedList `json:"err_txs"`
}
TxsStatus 交易集状态
type VmMessage ¶
type VmMessage interface {
From() string // 发送者
To() string // 接收者
Nonce() uint64 // 唯一码
GasLimit() uint64 // gasLimit
GasPrice() *big.Int // gasPrice
Value() *big.Int // value
Input() []byte // 合约请求的数据
CheckNonce() bool // 是否检测nonce
}
VmMessage 合约调用对象
func TxAsVmMessage ¶
func TxAsVmMessage(tx StateTransaction) (VmMessage, error)
TxAsVmMessage 将transaction转换为vmMessage
type WorkerType ¶
type WorkerType uint64
const ( Timing WorkerType = iota // 定时出块 TransactionTrigger // 交易触发,无空块 BlockStack // 定量空块 )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package accounts @author: xwc1125 Package accounts @author: xwc1125
|
Package accounts @author: xwc1125 Package accounts @author: xwc1125 |
|
Package eventtype @author: xwc1125
|
Package eventtype @author: xwc1125 |
|
Package ext external data @author: xwc1125
|
Package ext external data @author: xwc1125 |
|
Package permission @author: xwc1125 Package permission @author: xwc1125 Package permission @author: xwc1125
|
Package permission @author: xwc1125 Package permission @author: xwc1125 Package permission @author: xwc1125 |
|
Package statetype @author: xwc1125 Package statetype @author: xwc1125 Package statetype @author: xwc1125 Package statetype @author: xwc1125 Package statetype @author: xwc1125
|
Package statetype @author: xwc1125 Package statetype @author: xwc1125 Package statetype @author: xwc1125 Package statetype @author: xwc1125 Package statetype @author: xwc1125 |
|
Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125
|
Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125 Package vm @author: xwc1125 |