ax(mining): replace prose comments with usage examples in miner_factory
Two Principle 2 violations: globalFactory had a description comment instead of a usage example, and registerDefaults restated the function name. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
84d0515974
commit
ee8e6e1299
1 changed files with 3 additions and 2 deletions
|
|
@ -16,7 +16,8 @@ type MinerFactory struct {
|
|||
aliases map[string]string // maps aliases to canonical names
|
||||
}
|
||||
|
||||
// globalFactory is the default factory instance
|
||||
// globalFactory := NewMinerFactory()
|
||||
// miner, err := globalFactory.Create("xmrig")
|
||||
var globalFactory = NewMinerFactory()
|
||||
|
||||
// factory := NewMinerFactory()
|
||||
|
|
@ -30,7 +31,7 @@ func NewMinerFactory() *MinerFactory {
|
|||
return factory
|
||||
}
|
||||
|
||||
// registerDefaults registers all built-in miners
|
||||
// factory.registerDefaults() // called in NewMinerFactory(); adds xmrig, tt-miner, simulated to constructors
|
||||
func (factory *MinerFactory) registerDefaults() {
|
||||
// XMRig miner (CPU/GPU RandomX, Cryptonight, etc.)
|
||||
factory.Register("xmrig", func() Miner { return NewXMRigMiner() })
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue