Skip to content

Commit

Permalink
chore: skip no contribute nodes when index
Browse files Browse the repository at this point in the history
  • Loading branch information
Candinya committed Jun 24, 2024
1 parent e5401db commit 2ef811c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/service/indexer/l2/indexer_staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ func (s *server) indexStakingDistributeRewardsLog(ctx context.Context, header *t
// 5. billing: distribute request rewards

// Step 1: collect all data
bigZero := big.NewInt(0)
for i, nodeAddr := range stakingDistributeRewardsEvent.NodeAddrs {
if stakingDistributeRewardsEvent.RequestCounts[i].Cmp(bigZero) == 0 {
// No contribution in this epoch, skip
continue
}
err = databaseTransaction.SaveNodeRequestCount(ctx, &schema.NodeRequestRecord{

Check failure on line 49 in internal/service/indexer/l2/indexer_staking.go

View workflow job for this annotation

GitHub Actions / Lint

assignments should only be cuddled with other assignments (wsl)
NodeAddress: nodeAddr,
Epoch: stakingDistributeRewardsEvent.Epoch,
Expand Down Expand Up @@ -160,11 +165,6 @@ func (s *server) closeEpochExec(ctx context.Context, epoch *big.Int) {

for _, node := range allNodes {
// Calculate reward per node
if node.RequestCount.Cmp(big.NewInt(0)) == 0 {
// No contribution in this epoch, skip
continue
}

reward := new(big.Int).Mul(rewardPerRequest, node.RequestCount)

// Save into database
Expand Down

0 comments on commit 2ef811c

Please sign in to comment.