Merge pull request #1104 from XinFinOrg/fix-getrewardbyaccount-edgecase

fix: getrewardbyaccount api edge case
This commit is contained in:
Wanwiset Peerapatanapokin 2025-06-17 11:29:08 +04:00 committed by GitHub
commit 4142debefc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -467,6 +467,9 @@ func (api *API) getRewardFileNamesInRange(begin, end *rpc.BlockNumber) ([]reward
startIndex := sort.SearchInts(epochNumbers, int(beginHeader.Number.Int64()))
endIndex := sort.SearchInts(epochNumbers, int(endHeader.Number.Int64()))
if endIndex == len(epochNumbers) {
endIndex-- //this is to prevent endIndex out of bounds when endInput is higher than last reward(epoch) block but lower than latest block
}
var rewardfileNamesInRange []rewardFileName
for i := startIndex; i <= endIndex; i++ {