Skip to content

Commit

Permalink
Revert "Correct Pool Effort Calculations"
Browse files Browse the repository at this point in the history
This reverts commit 5af9d45.
  • Loading branch information
xiaolin1579 committed Jun 16, 2024
1 parent 5af9d45 commit 80d4f66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Miningcore/Api/Controllers/PoolApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public async Task<GetPoolsResponse> Get(CancellationToken ct, [FromQuery] uint t
if(lastBlockTime.HasValue)
{
var startTime = lastBlockTime.Value;
var poolEffort = await cf.Run(con => shareRepo.GetEffortBetweenCreatedAsync(con, config.Id, pool.ShareMultiplier, startTime, clock.Now));
var poolEffort = await cf.Run(con => shareRepo.GetEffortBetweenCreatedAsync(con, config.Id, startTime, clock.Now));
if(poolEffort.HasValue)
result.PoolEffort = poolEffort.Value;
}
Expand Down Expand Up @@ -143,7 +143,7 @@ public async Task<GetPoolResponse> GetPoolInfoAsync(string poolId, CancellationT
if(lastBlockTime.HasValue)
{
var startTime = lastBlockTime.Value;
var poolEffort = await cf.Run(con => shareRepo.GetEffortBetweenCreatedAsync(con, pool.Id, poolInstance.ShareMultiplier, startTime, clock.Now));
var poolEffort = await cf.Run(con => shareRepo.GetEffortBetweenCreatedAsync(con, pool.Id, startTime, clock.Now));
if(poolEffort.HasValue)
response.Pool.PoolEffort = poolEffort.Value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ public Task<long> CountSharesByMinerAsync(IDbConnection con, IDbTransaction tx,
return con.QuerySingleAsync<double?>(query, new { poolId, miner, start, end });
}

public Task<double?> GetEffortBetweenCreatedAsync(IDbConnection con, string poolId, double shareConst, DateTime start, DateTime end)
public Task<double?> GetEffortBetweenCreatedAsync(IDbConnection con, string poolId, DateTime start, DateTime end)
{
const string query = "SELECT SUM((difficulty * @shareConst) / networkdifficulty) FROM shares WHERE poolid = @poolId AND created > @start AND created < @end";
const string query = "SELECT SUM(difficulty / networkdifficulty) FROM shares WHERE poolid = @poolId AND created > @start AND created < @end";

return con.QuerySingleAsync<double?>(query, new { poolId, shareConst, start, end });
return con.QuerySingleAsync<double?>(query, new { poolId, start, end });
}

public async Task DeleteSharesByMinerAsync(IDbConnection con, IDbTransaction tx, string poolId, string miner, CancellationToken ct)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface IShareRepository
Task<double?> GetAccumulatedShareDifficultyBetweenAsync(IDbConnection con, string poolId, DateTime start, DateTime end, CancellationToken ct);
Task<double?> GetMinerShareDifficultyBetweenAsync(IDbConnection con, string poolId, string miner, DateTime start, DateTime end, CancellationToken ct);
Task<double?> GetEffectiveAccumulatedShareDifficultyBetweenAsync(IDbConnection con, string poolId, DateTime start, DateTime end, CancellationToken ct);
Task<double?> GetEffortBetweenCreatedAsync(IDbConnection con, string poolId, double shareConst, DateTime start, DateTime end);
Task<double?> GetEffortBetweenCreatedAsync(IDbConnection con, string poolId, DateTime start, DateTime end);
Task<MinerWorkerHashes[]> GetHashAccumulationBetweenAsync(IDbConnection con, string poolId, DateTime start, DateTime end, CancellationToken ct);
Task<double?> GetMinerEffortBetweenCreatedAsync(IDbConnection con, string poolId, string miner,DateTime start, DateTime end);
Task<string[]> GetRecentyUsedIpAddressesAsync(IDbConnection con, IDbTransaction tx, string poolId, string miner, CancellationToken ct);
Expand Down

0 comments on commit 80d4f66

Please sign in to comment.