fix: use stable endpoints for getBlocks (#20310)
This commit is contained in:
@ -3119,7 +3119,7 @@ export class Connection {
|
|||||||
endSlot !== undefined ? [startSlot, endSlot] : [startSlot],
|
endSlot !== undefined ? [startSlot, endSlot] : [startSlot],
|
||||||
commitment,
|
commitment,
|
||||||
);
|
);
|
||||||
const unsafeRes = await this._rpcRequest('getBlocks', args);
|
const unsafeRes = await this._rpcRequest('getConfirmedBlocks', args);
|
||||||
const res = create(unsafeRes, jsonRpcResult(array(number())));
|
const res = create(unsafeRes, jsonRpcResult(array(number())));
|
||||||
if ('error' in res) {
|
if ('error' in res) {
|
||||||
throw new Error('failed to get blocks: ' + res.error.message);
|
throw new Error('failed to get blocks: ' + res.error.message);
|
||||||
|
@ -2080,7 +2080,7 @@ describe('Connection', () => {
|
|||||||
|
|
||||||
it('get blocks between two slots', async () => {
|
it('get blocks between two slots', async () => {
|
||||||
await mockRpcResponse({
|
await mockRpcResponse({
|
||||||
method: 'getBlocks',
|
method: 'getConfirmedBlocks',
|
||||||
params: [0, 10],
|
params: [0, 10],
|
||||||
value: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
value: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||||
});
|
});
|
||||||
@ -2100,7 +2100,7 @@ describe('Connection', () => {
|
|||||||
|
|
||||||
it('get blocks from starting slot', async () => {
|
it('get blocks from starting slot', async () => {
|
||||||
await mockRpcResponse({
|
await mockRpcResponse({
|
||||||
method: 'getBlocks',
|
method: 'getConfirmedBlocks',
|
||||||
params: [0],
|
params: [0],
|
||||||
value: [
|
value: [
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
|
Reference in New Issue
Block a user