minemsg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// msg sent to worker by master
	StartMineMsg     = 0x1
	StopMineMsg      = 0x2
	WaitForCommitMsg = 0x3

	// work msg(one dispatch, one submit)
	NewDefaultWorkMsg    = 0x10
	SubmitDefaultWorkMsg = 0x11

	// msg sent to master by worker
	RegisterMsg           = 0x50
	UnRegisterMsg         = 0x51
	SetCurrentCoinbaseMsg = 0x52
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultWork

type DefaultWork struct {
	WorkerCoinbaseAddress common.Address

	// add block header for mining
	// the first 4 bytes of the nonce value is assigned by the sharding server,
	// and the next 4 assigned by the worker. The rest is accomplished by the miner.
	BlockHeader model.Header
	ResultNonce common.BlockNonce
	//pre-calculate rlp
	RlpPreCal []byte
}

func (*DefaultWork) CalBlockRlpWithoutNonce

func (work *DefaultWork) CalBlockRlpWithoutNonce()

func (*DefaultWork) CalHash

func (work *DefaultWork) CalHash() (common.Hash, error)

func (*DefaultWork) FillSealResult

func (work *DefaultWork) FillSealResult(curBlock model.AbstractBlock) error

func (*DefaultWork) GetWorkerCoinbaseAddress

func (work *DefaultWork) GetWorkerCoinbaseAddress() common.Address

func (*DefaultWork) SetWorkerCoinbaseAddress

func (work *DefaultWork) SetWorkerCoinbaseAddress(address common.Address)

func (*DefaultWork) Split

func (work *DefaultWork) Split(count int) (result []*DefaultWork)

split the work into several slices

type DefaultWorkBuilder

type DefaultWorkBuilder struct{}

func MakeDefaultWorkBuilder

func MakeDefaultWorkBuilder() *DefaultWorkBuilder

func (*DefaultWorkBuilder) BuildWorks

func (builder *DefaultWorkBuilder) BuildWorks(newBlock model.AbstractBlock, workerLen int) (workMsgCode int, works []Work)

type Register

type Register struct {
	Coinbase common.Address
}

type SetCurrentCoinbase

type SetCurrentCoinbase struct {
	Coinbase common.Address
}

type Work

type Work interface {
	GetWorkerCoinbaseAddress() common.Address
	SetWorkerCoinbaseAddress(address common.Address)
	//BlockNumber() *big.Int
	// fill seal result to current block
	FillSealResult(curBlock model.AbstractBlock) error
}

mine work

Jump to

Keyboard shortcuts

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