ax(mining): replace prose comments with usage examples in simulated_miner.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

AX Principle 2 — comments that restate what the type signature says
add zero information. Deleted five internal-method comments that merely
described function intent, and replaced three exported-method comments
with concrete call-site examples so agents see how to use them.

Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 10:28:07 +01:00
parent 2f2d863bed
commit 5843720a49
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -88,17 +88,17 @@ func (m *SimulatedMiner) GetType() string {
return m.MinerType
}
// Install is a no-op for simulated miners.
// if err := miner.Install(); err != nil { /* never errors */ }
func (m *SimulatedMiner) Install() error {
return nil
}
// Uninstall is a no-op for simulated miners.
// if err := miner.Uninstall(); err != nil { /* never errors */ }
func (m *SimulatedMiner) Uninstall() error {
return nil
}
// Start begins the simulated mining process.
// if err := miner.Start(config); err != nil { /* already running */ }
func (m *SimulatedMiner) Start(config *Config) error {
m.mu.Lock()
if m.Running {
@ -142,7 +142,6 @@ func (m *SimulatedMiner) Stop() error {
return nil
}
// runSimulation runs the background simulation loop.
func (m *SimulatedMiner) runSimulation() {
ticker := time.NewTicker(HighResolutionInterval)
defer ticker.Stop()
@ -164,7 +163,6 @@ func (m *SimulatedMiner) runSimulation() {
}
}
// updateHashrate generates a new hashrate value with realistic variation.
func (m *SimulatedMiner) updateHashrate() {
m.mu.Lock()
defer m.mu.Unlock()
@ -244,7 +242,6 @@ func (m *SimulatedMiner) updateHashrate() {
}
}
// simulateShare simulates finding a share.
func (m *SimulatedMiner) simulateShare() {
m.mu.Lock()
defer m.mu.Unlock()
@ -353,7 +350,7 @@ func (m *SimulatedMiner) AddHashratePoint(point HashratePoint) {
m.HashrateHistory = append(m.HashrateHistory, point)
}
// ReduceHashrateHistory reduces the history (called by manager).
// manager.ReduceHashrateHistory(miner, time.Now())
func (m *SimulatedMiner) ReduceHashrateHistory(now time.Time) {
m.mu.Lock()
defer m.mu.Unlock()
@ -406,7 +403,7 @@ func (m *SimulatedMiner) GetLogs() []string {
return result
}
// WriteStdin simulates stdin input.
// if err := miner.WriteStdin("h"); err != nil { /* not running */ }
func (m *SimulatedMiner) WriteStdin(input string) error {
m.mu.Lock()
defer m.mu.Unlock()