pokt-network / pocket-core

Official implementation of the Pocket Network Protocol
http://www.pokt.network
MIT License
209 stars 103 forks source link

[BUG REPORT] Current `/v1/nodes` route has incorrect result for `total_pages` on what is actually the last page of results. #1510

Open blockjoe opened 1 year ago

blockjoe commented 1 year ago

Via blocksandpixels#4229 on discord:

Hey all, there is a minor issue with the gateway API /v1/nodes endpoint. On the final page of results, the total_pages value is incorrect. If I curl with

"opts": {
    "page": 0,
    "per_page": 100,
    "staking_status": 1
  }

then total_pages is 20. However with

"opts": {
    "page": 20,
    "per_page": 100,
    "staking_status": 1
  },

… total_pages is 120 (varies depending on total number of results).

It looks as though total_pages is calculated as number of items / number of items on current page.