Skip to content

Commit d0b2d9a

Browse files
jochem-brouwerholgerd77
authored andcommitted
client: add types.ts into Fetcher dir
1 parent c507f3e commit d0b2d9a

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

packages/client/lib/sync/fetcher/blockfetcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Block, BlockBodyBuffer } from '@ethereumjs/block'
22
import { Peer } from '../../net/peer'
33
import { EthProtocolMethods } from '../../net/protocol'
4-
import { Job } from '../../types'
4+
import { Job } from './types'
55
import { BlockFetcherBase, JobTask, BlockFetcherOptions } from './blockfetcherbase'
66

77
/**

packages/client/lib/sync/fetcher/fetcher.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const Heap = require('qheap')
44
import { PeerPool } from '../../net/peerpool'
55
import { Config } from '../../config'
66

7-
import { QHeap, Job } from '../../types'
7+
import { QHeap } from '../../types'
8+
import { Job } from './types'
89
import { Peer } from '../../net/peer'
910

1011
export interface FetcherOptions {

packages/client/lib/sync/fetcher/headerfetcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BlockFetcherBase, BlockFetcherOptions, JobTask } from './blockfetcherba
22
import { Peer } from '../../net/peer'
33
import { FlowControl, LesProtocolMethods } from '../../net/protocol'
44
import { BlockHeader } from '@ethereumjs/block'
5-
import { Job } from '../../types'
5+
import { Job } from './types'
66
import { BN } from 'ethereumjs-util'
77

88
export interface HeaderFetcherOptions extends BlockFetcherOptions {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Peer } from "@ethereumjs/devp2p"
2+
3+
export type Job<JobTask, JobResult, StorageItem> = {
4+
task: JobTask
5+
time: number
6+
index: number
7+
result?: JobResult | StorageItem[]
8+
state: 'idle' | 'expired' | 'active'
9+
peer: Peer | null
10+
}

packages/client/lib/types.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,4 @@ export interface QHeap<T> {
3333
peek(): T | undefined
3434
length: number
3535
gc(opts: { minLength: number; maxLength: number }): void
36-
}
37-
38-
export type Job<JobTask, JobResult, StorageItem> = {
39-
task: JobTask
40-
time: number
41-
index: number
42-
result?: JobResult | StorageItem[]
43-
state: 'idle' | 'expired' | 'active'
44-
peer: Peer | null
45-
}
36+
}

0 commit comments

Comments
 (0)