Use ZeroDifficulty instead of empty struct
This commit is contained in:
parent
ff607bd67a
commit
165ce38d6e
|
@ -647,7 +647,7 @@ func main() {
|
|||
miner := share["miner"].(string)
|
||||
if _, ok := miners[miner]; !ok {
|
||||
miners[miner] = make(map[string]any)
|
||||
miners[miner]["weight"] = types.Difficulty{}
|
||||
miners[miner]["weight"] = types.ZeroDifficulty
|
||||
miners[miner]["shares"] = NewPositionChart(size, p2pool.PPLNSWindow*windowCount)
|
||||
miners[miner]["uncles"] = NewPositionChart(size, p2pool.PPLNSWindow*windowCount)
|
||||
if a, ok := share["miner_alias"]; ok {
|
||||
|
@ -668,7 +668,7 @@ func main() {
|
|||
miner := uncle["miner"].(string)
|
||||
if _, ok := miners[miner]; !ok {
|
||||
miners[miner] = make(map[string]any)
|
||||
miners[miner]["weight"] = types.Difficulty{}
|
||||
miners[miner]["weight"] = types.ZeroDifficulty
|
||||
miners[miner]["shares"] = NewPositionChart(size, p2pool.PPLNSWindow*windowCount)
|
||||
miners[miner]["uncles"] = NewPositionChart(size, p2pool.PPLNSWindow*windowCount)
|
||||
if a, ok := uncle["miner_alias"]; ok {
|
||||
|
|
|
@ -190,10 +190,10 @@ func (d Difficulty) MarshalJSON() ([]byte, error) {
|
|||
|
||||
func DifficultyFromString(s string) (Difficulty, error) {
|
||||
if buf, err := hex.DecodeString(s); err != nil {
|
||||
return Difficulty{}, err
|
||||
return ZeroDifficulty, err
|
||||
} else {
|
||||
if len(buf) != DifficultySize {
|
||||
return Difficulty{}, errors.New("wrong hash size")
|
||||
return ZeroDifficulty, errors.New("wrong hash size")
|
||||
}
|
||||
|
||||
return DifficultyFromBytes(buf), nil
|
||||
|
|
Loading…
Reference in a new issue