Skip to content

Commit

Permalink
Fix CalculateBonus()
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Aug 20, 2020
1 parent b05b8f6 commit 4ac4325
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/neo/SmartContract/Native/Tokens/NeoToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,16 @@ private BigInteger CalculateBonus(StoreView snapshot, BigInteger value, uint sta
for (var i = gasRecord.Count - 1; i >= 0; i--)
{
var currentIndex = gasRecord[i].Index;
if (currentIndex <= end)
if (currentIndex >= end) continue;
if (currentIndex > start)
{
if (currentIndex > start)
{
sum += gasRecord[i].GasPerBlock * (end - currentIndex);
end = currentIndex;
}
else
{
sum += gasRecord[i].GasPerBlock * (end - start);
break;
}
sum += gasRecord[i].GasPerBlock * (end - currentIndex);
end = currentIndex;
}
else
{
sum += gasRecord[i].GasPerBlock * (end - start);
break;
}
}
return value * sum * NeoHolderRewardRatio / 100 / TotalAmount;
Expand Down

0 comments on commit 4ac4325

Please sign in to comment.