MCPcopy
hub / github.com/subquery/subql / getBlockDispatcher

Function getBlockDispatcher

packages/node-core/src/indexer/fetch.service.spec.ts:201–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

199 }) as any as DictionaryService<any, any>;
200
201const getBlockDispatcher = () => {
202 const inst = {
203 init: (fn: any) => Promise.resolve(),
204 latestBufferedHeight: 0,
205 batchSize: 10,
206 freeSize: 10,
207 enqueueBlocks: (heights: number[], latestBufferHeight: number) => {
208 (inst as any).freeSize = inst.freeSize - heights.length;
209 inst.latestBufferedHeight = heights.length ? heights[heights.length - 1] : latestBufferHeight;
210 },
211 flushQueue: (height: number) => {
212 /* TODO */
213 },
214 } as BlockDispatcher<any, any>;
215
216 return inst;
217};
218
219jest.mock('../utils/promise', () => {
220 const original = jest.requireActual('../utils/promise');

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected