From 5843720a4940caeb7120dd25bf677b7df57fcac1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 10:28:07 +0100 Subject: [PATCH] ax(mining): replace prose comments with usage examples in simulated_miner.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- pkg/mining/simulated_miner.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/mining/simulated_miner.go b/pkg/mining/simulated_miner.go index 20a819b..92c17c8 100644 --- a/pkg/mining/simulated_miner.go +++ b/pkg/mining/simulated_miner.go @@ -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()