Skip to content

Commit 4cc7b82

Browse files
committed
fix: Distribute Reward happened behind the latest epoch
1 parent a22c185 commit 4cc7b82

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

cmd/dispatcher/handler.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,7 @@ func handleRequest(w http.ResponseWriter, r *http.Request, cfg *config.Dispatche
114114
interval = 10 // Default to distributing ten epochs
115115
}
116116

117-
if currentEpoch%uint64(interval) == 0 {
118-
time.Sleep(1 * time.Second)
119-
// Distribute rewards for the current epoch
120-
go DistributeRewardsWithRetry(currentEpoch, cfg, 3)
121-
}
117+
go DistributeRewardsWithRetry(currentEpoch - uint64(interval), cfg, 3)
122118
}
123119
}
124120

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type DispatcherConfig struct {
1616
EthRpcURL string `json:"eth_rpc_url"`
1717
EthChainID int64 `json:"eth_chain_id"`
1818
ValidatorStakingAddress string `json:"validator_staking_address"`
19-
RewardDistrInterval int `json:"reward_distr_interval"` // Number of epochs between reward distributions
19+
RewardDistrInterval int `json:"reward_distr_interval"` // Number of epochs behind the current epoch to start reward distributions
2020
}
2121

2222
// ValidatorConfig holds configuration for the validator service

0 commit comments

Comments
 (0)