Skip to content

Commit

Permalink
Use number for BestShare for AntMiner S19
Browse files Browse the repository at this point in the history
  • Loading branch information
x1unix committed Jan 15, 2021
1 parent 31712b5 commit a31fa12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions number.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cgminer

import (
"fmt"
"math"
"strconv"
)

Expand All @@ -27,12 +28,12 @@ func (n Number) Float64() float64 {

// Int64 returns the number as an int64.
func (n Number) Int64() int64 {
return int64(n)
return int64(n.Int())
}

// Int returns the number as an int.
func (n Number) Int() int {
return int(n)
return int(math.Round(float64(n)))
}

func (n *Number) UnmarshalJSON(b []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ type Devs struct {
// Pool - get working pools
type Pool struct {
Accepted int64
BestShare int64 `json:"Best Share"`
BestShare Number `json:"Best Share"`
Diff1Shares int64 `json:"Diff1 Shares"`
DifficultyAccepted float64 `json:"Difficulty Accepted"`
DifficultyRejected float64 `json:"Difficulty Rejected"`
Expand Down

0 comments on commit a31fa12

Please sign in to comment.