Skip to content

Commit

Permalink
gofmt ran
Browse files Browse the repository at this point in the history
  • Loading branch information
Tritonn204 committed Sep 5, 2024
1 parent 62c5bbd commit 8843c1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/spectrestratum/client_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ func (c *clientListener) NewBlockAvailable(kapi *SpectreApi, soloMining bool) {
// first pass through send config/default difficulty
state.stratumDiff = newSpectreDiff()
state.stratumDiff.setDiffValue(c.minShareDiff)
if (!soloMining) {
if !soloMining {
sendClientDiff(client, state)
}
c.shareHandler.setClientVardiff(client, c.minShareDiff)
}

varDiff := TargetToDiff(&state.bigDiff)
c.shareHandler.setSoloDiff(varDiff)
if (!soloMining) {
varDiff = c.shareHandler.getClientVardiff(client)
if !soloMining {
varDiff = c.shareHandler.getClientVardiff(client)
}

if varDiff != state.stratumDiff.diffValue {
// send updated vardiff
if (!soloMining) {
if !soloMining {
client.Logger.Info(fmt.Sprintf("changing diff from %f to %f", state.stratumDiff.diffValue, varDiff))
}
state.stratumDiff.setDiffValue(varDiff)
Expand Down
5 changes: 2 additions & 3 deletions src/spectrestratum/share_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type WorkStats struct {

type shareHandler struct {
spectre *rpcclient.RPCClient
soloDiff float64
soloDiff float64
stats map[string]*WorkStats
statsLock sync.Mutex
overall WorkStats
Expand Down Expand Up @@ -239,7 +239,7 @@ func (sh *shareHandler) HandleSubmit(ctx *gostratum.StratumContext, event gostra
return err
}
} else if powValue.Cmp(state.stratumDiff.targetValue) >= 0 {
if (soloMining) {
if soloMining {
ctx.Logger.Warn("weak block")
} else {
ctx.Logger.Warn("weak share")
Expand Down Expand Up @@ -323,7 +323,6 @@ func (sh *shareHandler) startStatsThread() error {
var lines []string
totalRate := float64(0)


for _, v := range sh.stats {
// print stats
rate := GetAverageHashrateKHs(v)
Expand Down
2 changes: 1 addition & 1 deletion src/spectrestratum/stratum_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type BridgeConfig struct {
PrintStats bool `yaml:"print_stats"`
UseLogFile bool `yaml:"log_to_file"`
HealthCheckPort string `yaml:"health_check_port"`
SoloMining bool `yaml:"solo_mining"`
SoloMining bool `yaml:"solo_mining"`
BlockWaitTime time.Duration `yaml:"block_wait_time"`
MinShareDiff uint `yaml:"min_share_diff"`
VarDiff bool `yaml:"var_diff"`
Expand Down

0 comments on commit 8843c1e

Please sign in to comment.