mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
Merge pull request #1104 from XinFinOrg/fix-getrewardbyaccount-edgecase
fix: getrewardbyaccount api edge case
This commit is contained in:
commit
4142debefc
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()))
|
startIndex := sort.SearchInts(epochNumbers, int(beginHeader.Number.Int64()))
|
||||||
endIndex := sort.SearchInts(epochNumbers, int(endHeader.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
|
var rewardfileNamesInRange []rewardFileName
|
||||||
for i := startIndex; i <= endIndex; i++ {
|
for i := startIndex; i <= endIndex; i++ {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue