Skip to content

Commit

Permalink
miner: Remove need for dcrd in benchmark mode.
Browse files Browse the repository at this point in the history
This makes it possible to run gominer in benchmark mode (-B) without
having setup a dcrd instance.  This is particularly useful when
comissioning new machines or testing the software, so that users do not
have to setup an entire simnet environment or wait for a full mainnet
dcrd and dcrwallet sync.
  • Loading branch information
matheusd committed Jan 20, 2024
1 parent b01524d commit db5d03a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ func newSoloMiner(ctx context.Context, devices []*Device) (*Miner, error) {
return m, nil
}

func newBenchmarkMiner(devices []*Device) (*Miner, error) {
return &Miner{
devices: devices,
}, nil
}

func NewMiner(ctx context.Context) (*Miner, error) {
workDone := make(chan []byte, 10)

Expand All @@ -139,6 +145,10 @@ func NewMiner(ctx context.Context) (*Miner, error) {
return nil, fmt.Errorf("no devices started")
}

if cfg.Benchmark {
return newBenchmarkMiner(devices)
}

var m *Miner
if cfg.Pool == "" {
m, err = newSoloMiner(ctx, devices)
Expand Down

0 comments on commit db5d03a

Please sign in to comment.