Skip to content

Commit

Permalink
fix: use stable endpoints for getBlocks (#20310)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry authored Sep 29, 2021
1 parent 32ece63 commit c02ef39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web3.js/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,7 @@ export class Connection {
endSlot !== undefined ? [startSlot, endSlot] : [startSlot],
commitment,
);
const unsafeRes = await this._rpcRequest('getBlocks', args);
const unsafeRes = await this._rpcRequest('getConfirmedBlocks', args);
const res = create(unsafeRes, jsonRpcResult(array(number())));
if ('error' in res) {
throw new Error('failed to get blocks: ' + res.error.message);
Expand Down
4 changes: 2 additions & 2 deletions web3.js/test/connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ describe('Connection', () => {

it('get blocks between two slots', async () => {
await mockRpcResponse({
method: 'getBlocks',
method: 'getConfirmedBlocks',
params: [0, 10],
value: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
});
Expand All @@ -2100,7 +2100,7 @@ describe('Connection', () => {

it('get blocks from starting slot', async () => {
await mockRpcResponse({
method: 'getBlocks',
method: 'getConfirmedBlocks',
params: [0],
value: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
Expand Down

0 comments on commit c02ef39

Please sign in to comment.