miner

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BCSByHeight

type BCSByHeight []*xpb.ChainStatus

func (BCSByHeight) Len

func (s BCSByHeight) Len() int

func (BCSByHeight) Less

func (s BCSByHeight) Less(i, j int) bool

func (BCSByHeight) Swap

func (s BCSByHeight) Swap(i, j int)

type Miner

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

负责生产和同步区块

func NewMiner

func NewMiner(ctx *common.ChainCtx) *Miner

func (*Miner) AssignRewards

func (t *Miner) AssignRewards(address string, blockAward *big.Int) *big.Int

func (*Miner) CalcVoteAward

func (t *Miner) CalcVoteAward(voteAward int64, ratio float64) *big.Int

计算投票奖励

func (*Miner) ClearThawTx

func (t *Miner) ClearThawTx(height int64, ctx xctx.XContext) error

func (*Miner) GenerateVoteAward

func (t *Miner) GenerateVoteAward(address string, remainAward *big.Int) ([]*lpb.Transaction, error)

func (*Miner) GetThawTx

func (t *Miner) GetThawTx(height int64, ctx xctx.XContext) ([]*lpb.Transaction, error)

构建解冻交易

func (*Miner) IsExit

func (t *Miner) IsExit() bool

func (*Miner) ProcBlock

func (t *Miner) ProcBlock(ctx xctx.XContext, block *lpb.InternalBlock) error

处理P2P网络中接收到的区块

func (*Miner) ReadTermTable

func (t *Miner) ReadTermTable(ctx xctx.XContext) (bool, error)

读term表

func (*Miner) Start

func (t *Miner) Start()

启动矿工,周期检查矿工身份 同一时间,矿工状态是唯一的。0:休眠中 1:同步区块中 2:打包区块中

func (*Miner) Stop

func (t *Miner) Stop()

停止矿工

func (*Miner) UpdateCacheTable

func (t *Miner) UpdateCacheTable(ctx xctx.XContext)

刷新缓存表

Jump to

Keyboard shortcuts

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