Skip to content

Commit

Permalink
Merge pull request #110 from ethstorage/issues
Browse files Browse the repository at this point in the history
expose miningInfo Attributes to other package
  • Loading branch information
ping-ke authored Dec 1, 2023
2 parents 4de97f9 + d247be2 commit 28fceaa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions ethstorage/miner/l1_mining_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ func (m *l1MiningAPI) GetMiningInfo(ctx context.Context, contract common.Address
return nil, err
}
mi := &miningInfo{
lastMineTime: res[0].(*big.Int).Uint64(),
difficulty: res[1].(*big.Int),
blockMined: res[2].(*big.Int),
LastMineTime: res[0].(*big.Int).Uint64(),
Difficulty: res[1].(*big.Int),
BlockMined: res[2].(*big.Int),
}
return mi, nil
}
Expand Down
12 changes: 6 additions & 6 deletions ethstorage/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ type MiningProver interface {
}

type miningInfo struct {
lastMineTime uint64
difficulty *big.Int
blockMined *big.Int
LastMineTime uint64
Difficulty *big.Int
BlockMined *big.Int
}

func (a *miningInfo) String() string {
return fmt.Sprintf(
"LastMineTime: %d, Difficulty: %s, BlockMined: %s",
a.lastMineTime,
a.difficulty.String(),
a.blockMined.String(),
a.LastMineTime,
a.Difficulty.String(),
a.BlockMined.String(),
)
}

Expand Down
6 changes: 3 additions & 3 deletions ethstorage/miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ func (w *worker) updateDifficulty(shardIdx, blockTime uint64) (*big.Int, error)
w.lg.Warn("Failed to get es mining info", "error", err.Error())
return nil, err
}
w.lg.Info("Mining info retrieved", "shard", shardIdx, "lastMineTime", info.lastMineTime, "difficulty", info.difficulty, "proofsSubmitted", info.blockMined)
w.lg.Info("Mining info retrieved", "shard", shardIdx, "LastMineTime", info.LastMineTime, "Difficulty", info.Difficulty, "proofsSubmitted", info.BlockMined)
reqDiff := new(big.Int).Div(maxUint256, expectedDiff(
info.lastMineTime,
info.LastMineTime,
blockTime,
info.difficulty,
info.Difficulty,
w.config.Cutoff,
w.config.DiffAdjDivisor,
w.config.MinimumDiff,
Expand Down

0 comments on commit 28fceaa

Please sign in to comment.