mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
add condition to fix endIndex out of bounds
This commit is contained in:
parent
ae70b5dc14
commit
796ee818e3
1 changed files with 3 additions and 0 deletions
|
|
@ -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 = endIndex - 1 //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++ {
|
||||
|
|
|
|||
Loading…
Reference in a new issue