Fix formatting and indentation
@@ -130,7 +130,7 @@ namespace Miningcore.Payments.PaymentSchemes
if(page.Length < pageSize)
break;
- before = page[page.Length - 1].Created;
+ before = page[^1].Created;
}
if(shares.Keys.Count > 0)
@@ -158,7 +158,7 @@ namespace Miningcore.Payments.PaymentSchemes
var accumulatedScore = 0.0m;
var blockRewardRemaining = blockReward;
DateTime? shareCutOffDate = null;
- Dictionary<string, decimal> scores = new Dictionary<string, decimal>();
+ var scores = new Dictionary<string, decimal>();
while(!done)
{
@@ -166,10 +166,11 @@ namespace Miningcore.Payments.PaymentSchemes
var page = await shareReadFaultPolicy.ExecuteAsync(() =>
cf.Run(con => shareRepo.ReadSharesBeforeCreatedAsync(con, poolConfig.Id, before, inclusive, pageSize)));
+
inclusive = false;
currentPage++;
- for(var i = 0; !done && i < page.Length; i++)
+ for(var i = 0; i < page.Length; i++)
{
var share = page[i];
var address = share.Miner;
@@ -186,11 +187,11 @@ namespace Miningcore.Payments.PaymentSchemes
scores[address] = score;
else
scores[address] += score;
+
accumulatedScore += score;
// set the cutoff date to clean up old shares after a successful payout
if(shareCutOffDate == null || share.Created > shareCutOffDate)
-
shareCutOffDate = share.Created;
}
@@ -200,7 +201,7 @@ namespace Miningcore.Payments.PaymentSchemes
break;
}
- before = page[page.Length - 1].Created;
+ before = page[^1].Created;
done = page.Length <= 0;
}
@@ -215,6 +216,7 @@ namespace Miningcore.Payments.PaymentSchemes
foreach(var score in scores.Where(x => x.Key == address))
{
var reward = score.Value * rewardPerScorePoint;
+
if(reward > 0)
{
// accumulate miner reward
@@ -223,6 +225,7 @@ namespace Miningcore.Payments.PaymentSchemes
else
rewards[address] += reward;
}
+
blockRewardRemaining -= reward;
}
}
