pow

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 18 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCoinBaseTx added in v0.1.1

func CreateCoinBaseTx(cfg *Config, nextBlockHeight uint32, addr string) (*types.Transaction, error)

func DisableLog added in v0.1.1

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func GenerateBlock added in v0.1.1

func GenerateBlock(cfg *Config) (*types.Block, error)

func GenerateBlockTransactions added in v0.1.1

func GenerateBlockTransactions(cfg *Config, msgBlock *types.Block, coinBaseTx *types.Transaction)

func NewCoinBaseTransaction added in v0.1.1

func NewCoinBaseTransaction(coinBasePayload *types.PayloadCoinBase, currentHeight uint32) *types.Transaction

func UseLogger added in v0.1.1

func UseLogger(logger elalog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using elalog.

Types

type ByFeeDesc added in v0.1.1

type ByFeeDesc []*types.Transaction

func (ByFeeDesc) Len added in v0.1.1

func (s ByFeeDesc) Len() int

func (ByFeeDesc) Less added in v0.1.1

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

func (ByFeeDesc) Swap added in v0.1.1

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

type Config added in v0.1.1

type Config struct {
	ChainParams *config.Params
	MinerAddr   string
	MinerInfo   string
	Server      server.IServer
	Chain       *blockchain.BlockChain
	TxMemPool   *mempool.TxPool
	TxFeeHelper *mempool.FeeHelper
	Validator   *mempool.Validator

	CreateCoinBaseTx          func(cfg *Config, nextBlockHeight uint32, addr string) (*types.Transaction, error)
	GenerateBlock             func(cfg *Config) (*types.Block, error)
	GenerateBlockTransactions func(cfg *Config, msgBlock *types.Block, coinBaseTx *types.Transaction)
	GetSpvHeight              func() uint32
	StoreAuxBlock             func(block interface{})
}

type Service added in v0.1.1

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

func NewService added in v0.1.1

func NewService(cfg *Config) *Service

func (*Service) CollectTransactions added in v0.1.1

func (s *Service) CollectTransactions(msgBlock *types.Block) int

func (*Service) CpuMining added in v0.1.1

func (s *Service) CpuMining()

func (*Service) DiscreteMining added in v0.1.1

func (s *Service) DiscreteMining(n uint32) ([]*common.Uint256, error)

func (*Service) GenerateAuxBlock added in v0.1.1

func (s *Service) GenerateAuxBlock(addr string) (*types.Block, string, bool)

func (*Service) GetTransactionCount added in v0.1.1

func (s *Service) GetTransactionCount() int

func (*Service) Halt added in v0.1.1

func (s *Service) Halt()

func (*Service) SetMinerAddr added in v0.1.1

func (s *Service) SetMinerAddr(minerAddr string)

func (*Service) SolveBlock added in v0.1.1

func (s *Service) SolveBlock(msgBlock *types.Block, ticker *time.Ticker) bool

func (*Service) Start added in v0.1.1

func (s *Service) Start()

func (*Service) SubmitAuxBlock added in v0.1.1

func (s *Service) SubmitAuxBlock(blockHash string, sideAuxData []byte) error

func (*Service) SubmitAuxBlockWithBlock added in v0.1.8

func (s *Service) SubmitAuxBlockWithBlock(block interface{}) error

Jump to

Keyboard shortcuts

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