Documentation ¶
Index ¶
- Constants
- func IsEqualForMiner(header *types.BlockHeader, other *types.BlockHeader) bool
- func UseLogger(logger l.Logger)
- type BlockChainChangeMsg
- type CPUMiningGenerateMsg
- type CPUWorker
- func (w *CPUWorker) GetType() string
- func (w *CPUWorker) HashesPerSecond() float64
- func (w *CPUWorker) IsRunning() bool
- func (w *CPUWorker) NumWorkers() int32
- func (w *CPUWorker) SetNumWorkers(numWorkers int32)
- func (w *CPUWorker) Start() error
- func (w *CPUWorker) Stop()
- func (w *CPUWorker) Update()
- type GBTMiningMsg
- type GBTWorker
- type IWorker
- type MempoolChangeMsg
- type Miner
- func (m *Miner) APIs() []api.API
- func (m *Miner) BlockChainChange()
- func (m *Miner) CPUMiningGenerate(discreteNum int, block chan *hash.Hash, powType pow.PowType) error
- func (m *Miner) CanMining() error
- func (m *Miner) GBTMining(request *json.TemplateRequest, reply chan *gbtResponse) error
- func (m *Miner) GetCoinbasePKAddress() *address.SecpPubKeyAddress
- func (m *Miner) IsEnable() bool
- func (m *Miner) MempoolChange()
- func (m *Miner) RemoteMining(powType pow.PowType, coinbaseFlags mining.CoinbaseFlags, ...) error
- func (m *Miner) Start() error
- func (m *Miner) StartCPUMining()
- func (m *Miner) Stop() error
- type PrivateMinerAPI
- type PublicMinerAPI
- func (api *PublicMinerAPI) GetBlockTemplate(capabilities []string, powType byte) (interface{}, error)
- func (api *PublicMinerAPI) GetMinerInfo() (interface{}, error)
- func (api *PublicMinerAPI) GetRemoteGBT(powType byte, extraNonce *bool) (interface{}, error)
- func (api *PublicMinerAPI) SubmitBlock(hexBlock string) (interface{}, error)
- func (api *PublicMinerAPI) SubmitBlockHeader(hexBlockHeader string, extraNonce *uint64) (interface{}, error)
- type RemoteMiningMsg
- type RemoteWorker
- func (w *RemoteWorker) GetRemoteGBTResult() *json.RemoteGBTResult
- func (w *RemoteWorker) GetRequest(powType pow.PowType, coinbaseFlags mining.CoinbaseFlags, ...)
- func (w *RemoteWorker) GetType() string
- func (w *RemoteWorker) IsRunning() bool
- func (w *RemoteWorker) Start() error
- func (w *RemoteWorker) Stop()
- func (w *RemoteWorker) Update()
- type StartCPUMiningMsg
Constants ¶
const ( CPUWorkerType = "CPU_Worker" GBTWorkerType = "GBT_Worker" RemoteWorkerType = "Remote_Worker" PoolWorkerType = "Pool_Worker" )
const ( // This is the timeout for HTTP requests to notify external miners. NotifyURLTimeout = 1 * time.Second )
const (
SubmitInterval = time.Second
)
Variables ¶
This section is empty.
Functions ¶
func IsEqualForMiner ¶
func IsEqualForMiner(header *types.BlockHeader, other *types.BlockHeader) bool
Types ¶
type BlockChainChangeMsg ¶
type BlockChainChangeMsg struct { }
type CPUMiningGenerateMsg ¶
type CPUMiningGenerateMsg struct {
// contains filtered or unexported fields
}
type CPUWorker ¶
func NewCPUWorker ¶
func (*CPUWorker) HashesPerSecond ¶
HashesPerSecond returns the number of hashes per second the mining process is performing. 0 is returned if the miner is not currently running.
This function is safe for concurrent access.
func (*CPUWorker) IsRunning ¶
IsRunning returns whether or not the CPU miner has been started and is therefore currenting mining.
This function is safe for concurrent access.
func (*CPUWorker) NumWorkers ¶
NumWorkers returns the number of workers which are running to solve blocks.
This function is safe for concurrent access.
func (*CPUWorker) SetNumWorkers ¶
SetNumWorkers sets the number of workers to create which solve blocks. Any negative values will cause a default number of workers to be used which is based on the number of processor cores in the system. A value of 0 will cause all CPU mining to be stopped.
This function is safe for concurrent access.
type GBTMiningMsg ¶
type GBTMiningMsg struct {
// contains filtered or unexported fields
}
type GBTWorker ¶
func NewGBTWorker ¶
func (*GBTWorker) GetRequest ¶
func (w *GBTWorker) GetRequest(request *json.TemplateRequest, reply chan *gbtResponse)
type MempoolChangeMsg ¶
type MempoolChangeMsg struct { }
type Miner ¶
type Miner struct { service.Service sync.Mutex RpcSer *rpc.RpcServer // contains filtered or unexported fields }
Miner creates blocks and searches for proof-of-work values.
func NewMiner ¶
func NewMiner(cfg *config.Config, policy *mining.Policy, sigCache *txscript.SigCache, txSource mining.TxSource, tsource blockchain.MedianTimeSource, blkMgr *blkmgr.BlockManager, events *event.Feed) *Miner
func (*Miner) BlockChainChange ¶
func (m *Miner) BlockChainChange()
func (*Miner) CPUMiningGenerate ¶
func (*Miner) GBTMining ¶
func (m *Miner) GBTMining(request *json.TemplateRequest, reply chan *gbtResponse) error
func (*Miner) GetCoinbasePKAddress ¶
func (m *Miner) GetCoinbasePKAddress() *address.SecpPubKeyAddress
func (*Miner) MempoolChange ¶
func (m *Miner) MempoolChange()
func (*Miner) RemoteMining ¶
func (*Miner) StartCPUMining ¶
func (m *Miner) StartCPUMining()
type PrivateMinerAPI ¶
type PrivateMinerAPI struct {
// contains filtered or unexported fields
}
PrivateMinerAPI provides private RPC methods to control the miner.
func NewPrivateMinerAPI ¶
func NewPrivateMinerAPI(m *Miner) *PrivateMinerAPI
type PublicMinerAPI ¶
type PublicMinerAPI struct {
// contains filtered or unexported fields
}
func NewPublicMinerAPI ¶
func NewPublicMinerAPI(m *Miner) *PublicMinerAPI
func (*PublicMinerAPI) GetBlockTemplate ¶
func (api *PublicMinerAPI) GetBlockTemplate(capabilities []string, powType byte) (interface{}, error)
func (api *PublicMinerAPI) GetBlockTemplate(request *mining.TemplateRequest) (interface{}, error){
func (*PublicMinerAPI) GetMinerInfo ¶
func (api *PublicMinerAPI) GetMinerInfo() (interface{}, error)
func (*PublicMinerAPI) GetRemoteGBT ¶
func (api *PublicMinerAPI) GetRemoteGBT(powType byte, extraNonce *bool) (interface{}, error)
func (*PublicMinerAPI) SubmitBlock ¶
func (api *PublicMinerAPI) SubmitBlock(hexBlock string) (interface{}, error)
LL Attempts to submit new block to network. See https://en.bitcoin.it/wiki/BIP_0022 for full specification
func (*PublicMinerAPI) SubmitBlockHeader ¶
func (api *PublicMinerAPI) SubmitBlockHeader(hexBlockHeader string, extraNonce *uint64) (interface{}, error)
type RemoteMiningMsg ¶
type RemoteMiningMsg struct {
// contains filtered or unexported fields
}
type RemoteWorker ¶
func NewRemoteWorker ¶
func NewRemoteWorker(miner *Miner) *RemoteWorker
func (*RemoteWorker) GetRemoteGBTResult ¶
func (w *RemoteWorker) GetRemoteGBTResult() *json.RemoteGBTResult
func (*RemoteWorker) GetRequest ¶
func (w *RemoteWorker) GetRequest(powType pow.PowType, coinbaseFlags mining.CoinbaseFlags, reply chan *gbtResponse)
func (*RemoteWorker) GetType ¶
func (w *RemoteWorker) GetType() string
func (*RemoteWorker) IsRunning ¶
func (w *RemoteWorker) IsRunning() bool
func (*RemoteWorker) Start ¶
func (w *RemoteWorker) Start() error
func (*RemoteWorker) Stop ¶
func (w *RemoteWorker) Stop()
func (*RemoteWorker) Update ¶
func (w *RemoteWorker) Update()
type StartCPUMiningMsg ¶
type StartCPUMiningMsg struct { }