tendermint-rpc: Set height in validatorsAll query

This commit is contained in:
willclarktech 2021-02-16 12:17:51 +00:00
parent c5adeace6d
commit 397d17d4c5
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7

View File

@ -260,13 +260,17 @@ export class Client {
public async validatorsAll(params: requests.ValidatorsParams): Promise<responses.ValidatorsResponse> {
let page = params.page || 1;
const validators: responses.Validator[] = [];
const baseParams = {
per_page: 50,
height: params.height ?? (await this.status()).syncInfo.latestBlockHeight,
...params,
};
let done = false;
let blockHeight = 0;
while (!done) {
const resp = await this.validators({
per_page: 50,
...params,
...baseParams,
page: page,
});
validators.push(...resp.validators);