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) BlockChain() *blockchain.BlockChain
- 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) CheckSubMainChainTip(parents []*hash.Hash) 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) StatsEmptyGbt()
- func (m *Miner) StatsGbt(currentReqMillSec int64, txcount int)
- func (m *Miner) StatsGbtRequest(currentReqMillSec int64, txcount int, longpollid string)
- func (m *Miner) StatsGbtTxEmptyAvgTimes()
- func (m *Miner) StatsSubmit(start time.Time, bh string, txcount int)
- func (m *Miner) Stop() error
- type MiningStats
- 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 (*Miner) BlockChain ¶ added in v1.0.19
func (m *Miner) BlockChain() *blockchain.BlockChain
func (*Miner) BlockChainChange ¶
func (m *Miner) BlockChainChange()
func (*Miner) CPUMiningGenerate ¶
func (*Miner) CheckSubMainChainTip ¶ added in v1.2.0
Checking the sub main chain for the parents of tip
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()
func (*Miner) StatsEmptyGbt ¶ added in v1.0.21
func (m *Miner) StatsEmptyGbt()
func (*Miner) StatsGbtRequest ¶ added in v1.0.21
func (*Miner) StatsGbtTxEmptyAvgTimes ¶ added in v1.0.21
func (m *Miner) StatsGbtTxEmptyAvgTimes()
func (*Miner) StatsSubmit ¶ added in v1.0.21
type MiningStats ¶ added in v1.0.21
type MiningStats struct { LastestGbt time.Time `json:"lastest_gbt"` LastestGbtRequest time.Time `json:"lastest_gbt_request"` LastestSubmit time.Time `json:"lastest_submit"` Lastest100GbtRequests []int64 `json:"-"` Lastest100Gbts []int64 `json:"-"` Lastest100GbtAvgDuration float64 `json:"lastest_100_gbt_avg_duration"` Lastest100GbtRequestAvgDuration float64 `json:"lastest_100_gbt_request_avg_duration"` Last100Submits []int64 `json:"-"` Last100SubmitAvgDuration float64 `json:"last_100_submit_avg_duration"` SubmitAvgDuration float64 `json:"submit_avg_duration"` TotalSubmitDuration float64 `json:"total_submit_duration"` TotalGbtDuration float64 `json:"total_gbt_duration"` GbtAvgDuration float64 `json:"gbt_avg_duration"` TotalGbtRequestDuration float64 `json:"total_gbt_request_duration"` GbtRequestAvgDuration float64 `json:"gbt_request_avg_duration"` MaxGbtDuration float64 `json:"max_gbt_duration"` MaxGbtRequestDuration float64 `json:"max_gbt_request_duration"` MaxGbtRequestTimeLongpollid string `json:"max_gbt_time_longpollid"` MaxSubmitDuration float64 `json:"max_submit_duration"` MaxSubmitDurationBlockHash string `json:"max_submit_duration_block_hash"` TotalGbts int64 `json:"total_gbts"` TotalGbtRequests int64 `json:"total_gbt_requests"` TotalEmptyGbts int64 `json:"total_empty_gbts"` TotalEmptyGbtDuarations int64 `json:"total_empty_gbt_duarations"` TotalEmptyGbtResponse int64 `json:"total_empty_gbt_response"` TotalSubmits int64 `json:"total_submits"` TotalTxEmptySubmits int64 `json:"total_tx_empty_submits"` LastestMempoolEmptyTimestamp int64 `json:"-"` TotalMempoolEmptyDuration float64 `json:"total_mempool_empty_duration"` MempoolEmptyAvgDuration float64 `json:"mempool_empty_avg_duration"` MempoolEmptyMaxDuration float64 `json:"mempool_empty_max_duration"` MempoolEmptyWarns int64 `json:"mempool_empty_warns"` Lastest100MempoolEmptyDuration []float64 `json:"lastest_100_mempool_empty_duration"` Lastest100MempoolEmptyAvgDuration float64 `json:"lastest_100_mempool_empty_avg_duration"` }
mining stats
func (*MiningStats) MarshalJSON ¶ added in v1.0.21
func (ms *MiningStats) MarshalJSON() ([]byte, error)
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
func (*PrivateMinerAPI) GetMiningStats ¶ added in v1.0.21
func (api *PrivateMinerAPI) GetMiningStats() (interface{}, error)
GetMiningStats func (api *PublicMinerAPI) GetMiningStats() (interface{}, error){
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 { }