diff --git a/docs/API.md b/docs/API.md index dccc5c9..d21b9fc 100644 --- a/docs/API.md +++ b/docs/API.md @@ -23,14 +23,6 @@
-## Classes - -EventEmitter
Binds a protocol implementation to the specified peer
-string
* [.handle(message, peer)](#module_handler.EthHandler+handle) ⇒ Promise
* [.Handler](#module_handler.Handler)
* [new Handler(options)](#new_module_handler.Handler_new)
+ * [.event](#module_handler.Handler+event) ⇒ string
+ * [.start()](#module_handler.Handler+start)
+ * [.stop()](#module_handler.Handler+stop)
* [.handle(message, peer)](#module_handler.Handler+handle) ⇒ Promise
* [.LesHandler](#module_handler.LesHandler)
* [new LesHandler(options)](#new_module_handler.LesHandler_new)
+ * [.event](#module_handler.LesHandler+event) ⇒ string
* [.handle(message, peer)](#module_handler.LesHandler+handle) ⇒ Promise
@@ -314,22 +310,16 @@ ETH protocol handler
**Kind**: static class of [handler
](#module_handler)
* [.EthHandler](#module_handler.EthHandler)
- * [new EthHandler(options)](#new_module_handler.EthHandler_new)
+ * [.event](#module_handler.EthHandler+event) ⇒ string
* [.handle(message, peer)](#module_handler.EthHandler+handle) ⇒ Promise
-
-
-#### new EthHandler(options)
-Create new handler
+
+#### ethHandler.event ⇒ string
+Message event to listen for
-| Param | Type | Description |
-| --- | --- | --- |
-| options | Object
| constructor parameters |
-| options.pool | PeerPool
| peer pool |
-| options.chain | Chain
| blockchain |
-| [options.logger] | Logger
| Logger instance |
-
+**Kind**: instance property of [EthHandler
](#module_handler.EthHandler)
+**Returns**: string
- name of message event
#### ethHandler.handle(message, peer) ⇒ Promise
@@ -351,6 +341,9 @@ Base class for protocol handlers
* [.Handler](#module_handler.Handler)
* [new Handler(options)](#new_module_handler.Handler_new)
+ * [.event](#module_handler.Handler+event) ⇒ string
+ * [.start()](#module_handler.Handler+start)
+ * [.stop()](#module_handler.Handler+stop)
* [.handle(message, peer)](#module_handler.Handler+handle) ⇒ Promise
@@ -366,6 +359,25 @@ Create new handler
| options.chain | Chain
| blockchain |
| [options.logger] | Logger
| Logger instance |
+
+
+#### handler.event ⇒ string
+Message event to listen for
+
+**Kind**: instance property of [Handler
](#module_handler.Handler)
+**Returns**: string
- name of message event
+
+
+#### handler.start()
+Start handler
+
+**Kind**: instance method of [Handler
](#module_handler.Handler)
+
+
+#### handler.stop()
+Stop handler
+
+**Kind**: instance method of [Handler
](#module_handler.Handler)
#### handler.handle(message, peer) ⇒ Promise
@@ -387,6 +399,7 @@ LES protocol handler
* [.LesHandler](#module_handler.LesHandler)
* [new LesHandler(options)](#new_module_handler.LesHandler_new)
+ * [.event](#module_handler.LesHandler+event) ⇒ string
* [.handle(message, peer)](#module_handler.LesHandler+handle) ⇒ Promise
@@ -403,6 +416,13 @@ Create new handler
| options.flow | FlowControl
| flow control manager |
| [options.logger] | Logger
| Logger instance |
+
+
+#### lesHandler.event ⇒ string
+Message event to listen for
+
+**Kind**: instance property of [LesHandler
](#module_handler.LesHandler)
+**Returns**: string
- name of message event
#### lesHandler.handle(message, peer) ⇒ Promise
@@ -696,7 +716,7 @@ Connected peers
#### peerPool.open() ⇒ Promise
-Open pool and make sure all associated servers are also open
+Open pool
**Kind**: instance method of [PeerPool
](#module_net.PeerPool)
@@ -769,6 +789,11 @@ Remove peer from pool
## net/protocol
* [net/protocol](#module_net/protocol)
+ * [.BoundProtocol](#module_net/protocol.BoundProtocol)
+ * [new BoundProtocol(options)](#new_module_net/protocol.BoundProtocol_new)
+ * [.send(name, args)](#module_net/protocol.BoundProtocol+send)
+ * [.request(name, args)](#module_net/protocol.BoundProtocol+request) ⇒ Promise
+ * [.addMethods()](#module_net/protocol.BoundProtocol+addMethods)
* [.EthProtocol](#module_net/protocol.EthProtocol)
* [new EthProtocol(options)](#new_module_net/protocol.EthProtocol_new)
* [.name](#module_net/protocol.EthProtocol+name) : string
@@ -813,6 +838,64 @@ Remove peer from pool
* [.sendStatus(status)](#module_net/protocol.Sender+sendStatus)
* [.sendMessage(code, rlpEncodedData)](#module_net/protocol.Sender+sendMessage)
+
+
+### net/protocol.BoundProtocol
+Binds a protocol implementation to the specified peer
+
+**Kind**: static class of [net/protocol
](#module_net/protocol)
+
+* [.BoundProtocol](#module_net/protocol.BoundProtocol)
+ * [new BoundProtocol(options)](#new_module_net/protocol.BoundProtocol_new)
+ * [.send(name, args)](#module_net/protocol.BoundProtocol+send)
+ * [.request(name, args)](#module_net/protocol.BoundProtocol+request) ⇒ Promise
+ * [.addMethods()](#module_net/protocol.BoundProtocol+addMethods)
+
+
+
+#### new BoundProtocol(options)
+Create bound protocol
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| options | Object
| constructor parameters |
+| options.protocol | Protocol
| protocol to bind |
+| options.peer | Peer
| peer that protocol is bound to |
+| options.sender | Sender
| message sender |
+
+
+
+#### boundProtocol.send(name, args)
+Send message with name and the specified args
+
+**Kind**: instance method of [BoundProtocol
](#module_net/protocol.BoundProtocol)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| name | string
| message name |
+| args | object
| message arguments |
+
+
+
+#### boundProtocol.request(name, args) ⇒ Promise
+Returns a promise that resolves with the message payload when a response
+to the specified message is received
+
+**Kind**: instance method of [BoundProtocol
](#module_net/protocol.BoundProtocol)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| name | string
| message to wait for |
+| args | object
| message arguments |
+
+
+
+#### boundProtocol.addMethods()
+Add a methods to the bound protocol for each protocol message that has a
+corresponding response message
+
+**Kind**: instance method of [BoundProtocol
](#module_net/protocol.BoundProtocol)
### net/protocol.EthProtocol
@@ -1163,7 +1246,7 @@ Decodes message payload
| --- | --- | --- |
| message | [Message
](#Protocol..Message) | message definition |
| payload | \*
| message payload |
-| bound | [BoundProtocol
](#BoundProtocol) | reference to bound protocol |
+| bound | BoundProtocol
| reference to bound protocol |
@@ -1282,7 +1365,7 @@ Send a message to peer
* [.stop()](#module_net/server.RlpxServer+stop) ⇒ Promise
* [.ban(peerId, [maxAge])](#module_net/server.RlpxServer+ban) ⇒ Promise
* [.Server](#module_net/server.Server)
- * [.running](#module_net/server.Server+running) : boolean
+ * [.running](#module_net/server.Server+running) ⇒ boolean
* [.start()](#module_net/server.Server+start) ⇒ Promise
* [.stop()](#module_net/server.Server+stop) ⇒ Promise
* [.addProtocols(protocols)](#module_net/server.Server+addProtocols)
@@ -1432,7 +1515,7 @@ Base class for transport specific server implementations.
**Kind**: static class of [net/server
](#module_net/server)
* [.Server](#module_net/server.Server)
- * [.running](#module_net/server.Server+running) : boolean
+ * [.running](#module_net/server.Server+running) ⇒ boolean
* [.start()](#module_net/server.Server+start) ⇒ Promise
* [.stop()](#module_net/server.Server+stop) ⇒ Promise
* [.addProtocols(protocols)](#module_net/server.Server+addProtocols)
@@ -1440,10 +1523,11 @@ Base class for transport specific server implementations.
-#### server.running : boolean
+#### server.running ⇒ boolean
Check if server is running
**Kind**: instance property of [Server
](#module_net/server.Server)
+**Returns**: boolean
- true if server is running
#### server.start() ⇒ Promise
@@ -1574,15 +1658,16 @@ middleware for parameters validation
* [.EthereumService](#module_service.EthereumService)
* [new EthereumService(options)](#new_module_service.EthereumService_new)
* [.name](#module_service.EthereumService+name) : string
- * [.protocols()](#module_service.EthereumService+protocols) : Array.<Protocol>
+ * [.protocols](#module_service.EthereumService+protocols) : Array.<Protocol>
* [.open()](#module_service.EthereumService+open) ⇒ Promise
* [.start()](#module_service.EthereumService+start) ⇒ Promise
* [.stop()](#module_service.EthereumService+stop) ⇒ Promise
* [.Service](#module_service.Service)
* [new Service(options)](#new_module_service.Service_new)
* [.name](#module_service.Service+name) : string
- * [.protocols()](#module_service.Service+protocols) : Array.<Protocol>
+ * [.protocols](#module_service.Service+protocols) : Array.<Protocol>
* [.open()](#module_service.Service+open) ⇒ Promise
+ * [.close()](#module_service.Service+close) ⇒ Promise
* [.start()](#module_service.Service+start) ⇒ Promise
* [.stop()](#module_service.Service+stop) ⇒ Promise
@@ -1596,7 +1681,7 @@ Ethereum service
* [.EthereumService](#module_service.EthereumService)
* [new EthereumService(options)](#new_module_service.EthereumService_new)
* [.name](#module_service.EthereumService+name) : string
- * [.protocols()](#module_service.EthereumService+protocols) : Array.<Protocol>
+ * [.protocols](#module_service.EthereumService+protocols) : Array.<Protocol>
* [.open()](#module_service.EthereumService+open) ⇒ Promise
* [.start()](#module_service.EthereumService+start) ⇒ Promise
* [.stop()](#module_service.EthereumService+stop) ⇒ Promise
@@ -1613,8 +1698,9 @@ Create new ETH service
| options.servers | Array.<Server>
| | servers to run service on |
| [options.syncmode] | string
| "light"
| synchronization mode ('fast' or 'light') |
| [options.lightserv] | boolean
| false
| serve LES requests |
+| [options.chain] | Chain
| | blockchain |
| [options.common] | Common
| | ethereum network name |
-| [options.db] | LevelDB
|
| blockchain database |
+| [options.interval] | number
| | sync interval |
| [options.logger] | Logger
| | logger instance |
@@ -1626,10 +1712,10 @@ Service name
**Access**: protected
-#### ethereumService.protocols() : Array.<Protocol>
+#### ethereumService.protocols : Array.<Protocol>
Returns all protocols required by this service
-**Kind**: instance method of [EthereumService
](#module_service.EthereumService)
+**Kind**: instance property of [EthereumService
](#module_service.EthereumService)
#### ethereumService.open() ⇒ Promise
@@ -1659,8 +1745,9 @@ Base class for all services
* [.Service](#module_service.Service)
* [new Service(options)](#new_module_service.Service_new)
* [.name](#module_service.Service+name) : string
- * [.protocols()](#module_service.Service+protocols) : Array.<Protocol>
+ * [.protocols](#module_service.Service+protocols) : Array.<Protocol>
* [.open()](#module_service.Service+open) ⇒ Promise
+ * [.close()](#module_service.Service+close) ⇒ Promise
* [.start()](#module_service.Service+start) ⇒ Promise
* [.stop()](#module_service.Service+stop) ⇒ Promise
@@ -1685,15 +1772,21 @@ Service name
**Access**: protected
-#### service.protocols() : Array.<Protocol>
+#### service.protocols : Array.<Protocol>
Returns all protocols required by this service
-**Kind**: instance method of [Service
](#module_service.Service)
+**Kind**: instance property of [Service
](#module_service.Service)
#### service.open() ⇒ Promise
Open service. Must be called before service is started
+**Kind**: instance method of [Service
](#module_service.Service)
+
+
+#### service.close() ⇒ Promise
+Close service.
+
**Kind**: instance method of [Service
](#module_service.Service)
@@ -1712,6 +1805,12 @@ Start service
## sync
* [sync](#module_sync)
+ * [.BlockFetcher](#module_sync.BlockFetcher)
+ * [new BlockFetcher(options)](#new_module_sync.BlockFetcher_new)
+ * [.open()](#module_sync.BlockFetcher+open) ⇒ Promise
+ * [.before(taskOne, taskTwo)](#module_sync.BlockFetcher+before) ⇒ boolean
+ * [.fetch(task, peer)](#module_sync.BlockFetcher+fetch) ⇒ Promise
+ * [.process(entry, reply)](#module_sync.BlockFetcher+process)
* [.FastSynchronizer](#module_sync.FastSynchronizer)
* [new FastSynchronizer(options)](#new_module_sync.FastSynchronizer_new)
* [.type](#module_sync.FastSynchronizer+type) ⇒ string
@@ -1721,11 +1820,7 @@ Start service
* [.fetch([last])](#module_sync.FastSynchronizer+fetch) ⇒ Promise
* [.handle(message, peer)](#module_sync.FastSynchronizer+handle) ⇒ Promise
* [.open()](#module_sync.FastSynchronizer+open) ⇒ Promise
- * [.BlockFetcher](#module_sync.BlockFetcher)
- * [new BlockFetcher(options)](#new_module_sync.BlockFetcher_new)
- * [.before(taskOne, taskTwo)](#module_sync.BlockFetcher+before) ⇒ boolean
- * [.fetch(task, peer)](#module_sync.BlockFetcher+fetch) ⇒ Promise
- * [.process(entry, reply)](#module_sync.BlockFetcher+process)
+ * [.stop()](#module_sync.FastSynchronizer+stop) ⇒ Promise
* [.Fetcher](#module_sync.Fetcher)
* [new Fetcher(options)](#new_module_sync.Fetcher_new)
* [.add(task)](#module_sync.Fetcher+add)
@@ -1733,12 +1828,19 @@ Start service
* [.handle(reply, peer)](#module_sync.Fetcher+handle)
* [.error(error, task, peer)](#module_sync.Fetcher+error)
* [.expire()](#module_sync.Fetcher+expire)
+ * [.open()](#module_sync.Fetcher+open) ⇒ Promise
* [.start()](#module_sync.Fetcher+start) ⇒ Promise
* [.stop()](#module_sync.Fetcher+stop) ⇒ Promise
* [.before(taskOne, taskTwo)](#module_sync.Fetcher+before) ⇒ boolean
* [.fetchable(peer)](#module_sync.Fetcher+fetchable) ⇒ boolean
* [.fetch(task, peer)](#module_sync.Fetcher+fetch) ⇒ Promise
* [.process(entry, reply)](#module_sync.Fetcher+process)
+ * [.HeaderFetcher](#module_sync.HeaderFetcher)
+ * [new HeaderFetcher(options)](#new_module_sync.HeaderFetcher_new)
+ * [.open()](#module_sync.HeaderFetcher+open) ⇒ Promise
+ * [.before(taskOne, taskTwo)](#module_sync.HeaderFetcher+before) ⇒ boolean
+ * [.fetch(task, peer)](#module_sync.HeaderFetcher+fetch) ⇒ Promise
+ * [.process(entry, reply)](#module_sync.HeaderFetcher+process)
* [.LightSynchronizer](#module_sync.LightSynchronizer)
* [new LightSynchronizer(options)](#new_module_sync.LightSynchronizer_new)
* [.type](#module_sync.LightSynchronizer+type) ⇒ string
@@ -1747,11 +1849,7 @@ Start service
* [.fetch([last])](#module_sync.LightSynchronizer+fetch) ⇒ Promise
* [.handle(message, peer)](#module_sync.LightSynchronizer+handle) ⇒ Promise
* [.open()](#module_sync.LightSynchronizer+open) ⇒ Promise
- * [.HeaderFetcher](#module_sync.HeaderFetcher)
- * [new HeaderFetcher(options)](#new_module_sync.HeaderFetcher_new)
- * [.before(taskOne, taskTwo)](#module_sync.HeaderFetcher+before) ⇒ boolean
- * [.fetch(task, peer)](#module_sync.HeaderFetcher+fetch) ⇒ Promise
- * [.process(entry, reply)](#module_sync.HeaderFetcher+process)
+ * [.stop()](#module_sync.LightSynchronizer+stop) ⇒ Promise
* [.Synchronizer](#module_sync.Synchronizer)
* [new Synchronizer(options)](#new_module_sync.Synchronizer_new)
* [.type](#module_sync.Synchronizer+type) ⇒ string
@@ -1760,6 +1858,82 @@ Start service
* [.sync([height])](#module_sync.Synchronizer+sync) ⇒ Promise
* [.stop()](#module_sync.Synchronizer+stop) ⇒ Promise
+
+
+### sync.BlockFetcher
+Implements an eth/62 based block fetcher
+
+**Kind**: static class of [sync
](#module_sync)
+
+* [.BlockFetcher](#module_sync.BlockFetcher)
+ * [new BlockFetcher(options)](#new_module_sync.BlockFetcher_new)
+ * [.open()](#module_sync.BlockFetcher+open) ⇒ Promise
+ * [.before(taskOne, taskTwo)](#module_sync.BlockFetcher+before) ⇒ boolean
+ * [.fetch(task, peer)](#module_sync.BlockFetcher+fetch) ⇒ Promise
+ * [.process(entry, reply)](#module_sync.BlockFetcher+process)
+
+
+
+#### new BlockFetcher(options)
+Create new block fetcher
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| options | Object
| | constructor parameters |
+| options.pool | PeerPool
| | peer pool |
+| options.chain | Chain
| | blockchain |
+| [options.maxPerRequest] | number
| 128
| max items per request |
+| [options.logger] | Logger
| | Logger instance |
+
+
+
+#### blockFetcher.open() ⇒ Promise
+Open block fetcher. Must be called before fetcher is started
+
+**Kind**: instance method of [BlockFetcher
](#module_sync.BlockFetcher)
+
+
+#### blockFetcher.before(taskOne, taskTwo) ⇒ boolean
+Prioritizes tasks based on first block number
+
+**Kind**: instance method of [BlockFetcher
](#module_sync.BlockFetcher)
+**Returns**: boolean
- true if taskOne has a lower first number than taskTwo
+
+| Param | Type |
+| --- | --- |
+| taskOne | Object
|
+| taskTwo | Object
|
+
+
+
+#### blockFetcher.fetch(task, peer) ⇒ Promise
+Fetches blocks for the given task
+
+**Kind**: instance method of [BlockFetcher
](#module_sync.BlockFetcher)
+**Returns**: Promise
- method must return
+
+| Param | Type |
+| --- | --- |
+| task | Object
|
+| peer | Peer
|
+
+
+
+#### blockFetcher.process(entry, reply)
+Process fetch reply
+
+**Kind**: instance method of [BlockFetcher
](#module_sync.BlockFetcher)
+**Emits**: event:headers
+
+| Param | Type | Description |
+| --- | --- | --- |
+| entry | Object
| entry object |
+| entry.task | Object
| fetch task |
+| entry.peer | Peer
| peer that handled task |
+| entry.time | number
| time task was generated |
+| reply | Object
| reply data |
+
### sync.FastSynchronizer
@@ -1776,6 +1950,7 @@ Implements an ethereum fast sync synchronizer
* [.fetch([last])](#module_sync.FastSynchronizer+fetch) ⇒ Promise
* [.handle(message, peer)](#module_sync.FastSynchronizer+handle) ⇒ Promise
* [.open()](#module_sync.FastSynchronizer+open) ⇒ Promise
+ * [.stop()](#module_sync.FastSynchronizer+stop) ⇒ Promise
@@ -1856,74 +2031,12 @@ Handler for incoming requests from connected peers
Open synchronizer. Must be called before sync() is called
**Kind**: instance method of [FastSynchronizer
](#module_sync.FastSynchronizer)
-
-
-### sync.BlockFetcher
-Implements an eth/62 based block fetcher
-
-**Kind**: static class of [sync
](#module_sync)
-
-* [.BlockFetcher](#module_sync.BlockFetcher)
- * [new BlockFetcher(options)](#new_module_sync.BlockFetcher_new)
- * [.before(taskOne, taskTwo)](#module_sync.BlockFetcher+before) ⇒ boolean
- * [.fetch(task, peer)](#module_sync.BlockFetcher+fetch) ⇒ Promise
- * [.process(entry, reply)](#module_sync.BlockFetcher+process)
-
-
-
-#### new BlockFetcher(options)
-Create new block fetcher
-
-
-| Param | Type | Description |
-| --- | --- | --- |
-| options | Object
| constructor parameters |
-| options.pool | PeerPool
| peer pool |
-| options.sync | Synchronizer
| parent synchronizer |
-| [options.logger] | Logger
| Logger instance |
-
-
-
-#### blockFetcher.before(taskOne, taskTwo) ⇒ boolean
-Prioritizes tasks based on first block number
-
-**Kind**: instance method of [BlockFetcher
](#module_sync.BlockFetcher)
-**Returns**: boolean
- true if taskOne has a lower first number than taskTwo
-
-| Param | Type |
-| --- | --- |
-| taskOne | Object
|
-| taskTwo | Object
|
-
-
-
-#### blockFetcher.fetch(task, peer) ⇒ Promise
-Fetches blocks for the given task
-
-**Kind**: instance method of [BlockFetcher
](#module_sync.BlockFetcher)
-**Returns**: Promise
- method must return
-
-| Param | Type |
-| --- | --- |
-| task | Object
|
-| peer | Peer
|
-
-
-
-#### blockFetcher.process(entry, reply)
-Process fetch reply
-
-**Kind**: instance method of [BlockFetcher
](#module_sync.BlockFetcher)
-**Emits**: event:headers
+
-| Param | Type | Description |
-| --- | --- | --- |
-| entry | Object
| entry object |
-| entry.task | Object
| fetch task |
-| entry.peer | Peer
| peer that handled task |
-| entry.time | number
| time task was generated |
-| reply | Object
| reply data |
+#### fastSynchronizer.stop() ⇒ Promise
+Stop synchronization. Returns a promise that resolves once its stopped.
+**Kind**: instance method of [FastSynchronizer
](#module_sync.FastSynchronizer)
### sync.Fetcher
@@ -1941,6 +2054,7 @@ ensure most important tasks are processed first based on the before() function.
* [.handle(reply, peer)](#module_sync.Fetcher+handle)
* [.error(error, task, peer)](#module_sync.Fetcher+error)
* [.expire()](#module_sync.Fetcher+expire)
+ * [.open()](#module_sync.Fetcher+open) ⇒ Promise
* [.start()](#module_sync.Fetcher+start) ⇒ Promise
* [.stop()](#module_sync.Fetcher+stop) ⇒ Promise
* [.before(taskOne, taskTwo)](#module_sync.Fetcher+before) ⇒ boolean
@@ -1958,6 +2072,8 @@ Create new fetcher
| --- | --- | --- |
| options | Object
| constructor parameters |
| options.pool | PeerPool
| peer pool |
+| [options.timeout] | number
| fetch task timeout |
+| [options.interval] | number
| retry interval |
| [options.logger] | Logger
| Logger instance |
@@ -2010,6 +2126,12 @@ Expires all tasks that have timed out. Peers that take too long to respond
will be banned for 5 minutes. Timeout out tasks will be re-inserted into the
queue.
+**Kind**: instance method of [Fetcher
](#module_sync.Fetcher)
+
+
+#### fetcher.open() ⇒ Promise
+Open fetcher. Must be called before fetcher is started
+
**Kind**: instance method of [Fetcher
](#module_sync.Fetcher)
@@ -2074,6 +2196,83 @@ Process the reply for the given fetch queue entry
| entry.time | number
| time task was generated |
| reply | Object
| reply data |
+
+
+### sync.HeaderFetcher
+Implements an les/1 based header fetcher
+
+**Kind**: static class of [sync
](#module_sync)
+
+* [.HeaderFetcher](#module_sync.HeaderFetcher)
+ * [new HeaderFetcher(options)](#new_module_sync.HeaderFetcher_new)
+ * [.open()](#module_sync.HeaderFetcher+open) ⇒ Promise
+ * [.before(taskOne, taskTwo)](#module_sync.HeaderFetcher+before) ⇒ boolean
+ * [.fetch(task, peer)](#module_sync.HeaderFetcher+fetch) ⇒ Promise
+ * [.process(entry, reply)](#module_sync.HeaderFetcher+process)
+
+
+
+#### new HeaderFetcher(options)
+Create new header fetcher
+
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| options | Object
| | constructor parameters |
+| options.pool | PeerPool
| | peer pool |
+| options.flow | FlowControl
| | flow control manager |
+| options.chain | Chain
| | blockchain |
+| [options.maxPerRequest] | number
| 192
| max items per request |
+| [options.logger] | Logger
| | Logger instance |
+
+
+
+#### headerFetcher.open() ⇒ Promise
+Open header fetcher. Must be called before fetcher is started
+
+**Kind**: instance method of [HeaderFetcher
](#module_sync.HeaderFetcher)
+
+
+#### headerFetcher.before(taskOne, taskTwo) ⇒ boolean
+Prioritizes tasks based on first block number
+
+**Kind**: instance method of [HeaderFetcher
](#module_sync.HeaderFetcher)
+**Returns**: boolean
- true if taskOne has a lower first number than taskTwo
+
+| Param | Type |
+| --- | --- |
+| taskOne | Object
|
+| taskTwo | Object
|
+
+
+
+#### headerFetcher.fetch(task, peer) ⇒ Promise
+Fetches block headers for the given task
+
+**Kind**: instance method of [HeaderFetcher
](#module_sync.HeaderFetcher)
+**Returns**: Promise
- method must return
+
+| Param | Type |
+| --- | --- |
+| task | Object
|
+| peer | Peer
|
+
+
+
+#### headerFetcher.process(entry, reply)
+Process the getBlockHeaders reply
+
+**Kind**: instance method of [HeaderFetcher
](#module_sync.HeaderFetcher)
+**Emits**: event:headers
+
+| Param | Type | Description |
+| --- | --- | --- |
+| entry | Object
| entry object |
+| entry.task | Object
| fetch task |
+| entry.peer | Peer
| peer that handled task |
+| entry.time | number
| time task was generated |
+| reply | Object
| reply data |
+
### sync.LightSynchronizer
@@ -2089,6 +2288,7 @@ Implements an ethereum light sync synchronizer
* [.fetch([last])](#module_sync.LightSynchronizer+fetch) ⇒ Promise
* [.handle(message, peer)](#module_sync.LightSynchronizer+handle) ⇒ Promise
* [.open()](#module_sync.LightSynchronizer+open) ⇒ Promise
+ * [.stop()](#module_sync.LightSynchronizer+stop) ⇒ Promise
@@ -2158,75 +2358,12 @@ Handler for incoming requests from connected peers
Open synchronizer. Must be called before sync() is called
**Kind**: instance method of [LightSynchronizer
](#module_sync.LightSynchronizer)
-
-
-### sync.HeaderFetcher
-Implements an les/1 based header fetcher
-
-**Kind**: static class of [sync
](#module_sync)
-
-* [.HeaderFetcher](#module_sync.HeaderFetcher)
- * [new HeaderFetcher(options)](#new_module_sync.HeaderFetcher_new)
- * [.before(taskOne, taskTwo)](#module_sync.HeaderFetcher+before) ⇒ boolean
- * [.fetch(task, peer)](#module_sync.HeaderFetcher+fetch) ⇒ Promise
- * [.process(entry, reply)](#module_sync.HeaderFetcher+process)
-
-
-
-#### new HeaderFetcher(options)
-Create new header fetcher
-
-
-| Param | Type | Description |
-| --- | --- | --- |
-| options | Object
| constructor parameters |
-| options.pool | PeerPool
| peer pool |
-| options.flow | FlowControl
| flow control manager |
-| options.sync | Synchronizer
| parent synchronizer |
-| [options.logger] | Logger
| Logger instance |
-
-
-
-#### headerFetcher.before(taskOne, taskTwo) ⇒ boolean
-Prioritizes tasks based on first block number
-
-**Kind**: instance method of [HeaderFetcher
](#module_sync.HeaderFetcher)
-**Returns**: boolean
- true if taskOne has a lower first number than taskTwo
-
-| Param | Type |
-| --- | --- |
-| taskOne | Object
|
-| taskTwo | Object
|
-
-
-
-#### headerFetcher.fetch(task, peer) ⇒ Promise
-Fetches block headers for the given task
-
-**Kind**: instance method of [HeaderFetcher
](#module_sync.HeaderFetcher)
-**Returns**: Promise
- method must return
-
-| Param | Type |
-| --- | --- |
-| task | Object
|
-| peer | Peer
|
-
-
-
-#### headerFetcher.process(entry, reply)
-Process the getBlockHeaders reply
+
-**Kind**: instance method of [HeaderFetcher
](#module_sync.HeaderFetcher)
-**Emits**: event:headers
-
-| Param | Type | Description |
-| --- | --- | --- |
-| entry | Object
| entry object |
-| entry.task | Object
| fetch task |
-| entry.peer | Peer
| peer that handled task |
-| entry.time | number
| time task was generated |
-| reply | Object
| reply data |
+#### lightSynchronizer.stop() ⇒ Promise
+Stop synchronization. Returns a promise that resolves once its stopped.
+**Kind**: instance method of [LightSynchronizer
](#module_sync.LightSynchronizer)
### sync.Synchronizer
@@ -2296,65 +2433,6 @@ Stop synchronization. Returns a promise that resolves once its stopped.
## util
-
-
-## BoundProtocol ⇐ EventEmitter
-Binds a protocol implementation to the specified peer
-
-**Kind**: global class
-**Extends**: EventEmitter
-
-* [BoundProtocol](#BoundProtocol) ⇐ EventEmitter
- * [new BoundProtocol(options)](#new_BoundProtocol_new)
- * [.send(name, args)](#BoundProtocol+send)
- * [.request(name, args)](#BoundProtocol+request) ⇒ Promise
- * [.addMethods()](#BoundProtocol+addMethods)
-
-
-
-### new BoundProtocol(options)
-Create bound protocol
-
-
-| Param | Type | Description |
-| --- | --- | --- |
-| options | Object
| constructor parameters |
-| options.protocol | Protocol
| protocol to bind |
-| options.peer | Peer
| peer that protocol is bound to |
-| options.sender | Sender
| message sender |
-
-
-
-### boundProtocol.send(name, args)
-Send message with name and the specified args
-
-**Kind**: instance method of [BoundProtocol
](#BoundProtocol)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| name | string
| message name |
-| args | object
| message arguments |
-
-
-
-### boundProtocol.request(name, args) ⇒ Promise
-Returns a promise that resolves with the message payload when a response
-to the specified message is received
-
-**Kind**: instance method of [BoundProtocol
](#BoundProtocol)
-
-| Param | Type | Description |
-| --- | --- | --- |
-| name | string
| message to wait for |
-| args | object
| message arguments |
-
-
-
-### boundProtocol.addMethods()
-Add a methods to the bound protocol for each protocol message that has a
-corresponding response message
-
-**Kind**: instance method of [BoundProtocol
](#BoundProtocol)
## define(name, path)
diff --git a/lib/net/server/server.js b/lib/net/server/server.js
index 94fb992..3ec96fd 100644
--- a/lib/net/server/server.js
+++ b/lib/net/server/server.js
@@ -31,7 +31,7 @@ class Server extends EventEmitter {
/**
* Check if server is running
- * @type {boolean} true if server is running
+ * @return {boolean} true if server is running
*/
get running () {
return this.started
diff --git a/lib/rpc/modules/eth.js b/lib/rpc/modules/eth.js
index 7115b6f..b36e8ca 100644
--- a/lib/rpc/modules/eth.js
+++ b/lib/rpc/modules/eth.js
@@ -78,7 +78,7 @@ class Eth {
/**
* Returns the current ethereum protocol version
- * @param {Array<>} [params] An empty array
+ * @param {Array<*>} [params] An empty array
* @param {Function} [cb] A function with an error object as the first argument and a
* hex-encoded string of the current protocol version as the second argument
*/
diff --git a/lib/rpc/modules/net.js b/lib/rpc/modules/net.js
index a2b5077..caf154a 100644
--- a/lib/rpc/modules/net.js
+++ b/lib/rpc/modules/net.js
@@ -25,7 +25,7 @@ class Net {
/**
* Returns the current network id
- * @param {Array<>} [params] An empty array
+ * @param {Array<*>} [params] An empty array
* @param {Function} [cb] A function with an error object as the first argument and the network
* id as the second argument
*/
@@ -35,7 +35,7 @@ class Net {
/**
* Returns true if client is actively listening for network connections
- * @param {Array<>} [params] An empty array
+ * @param {Array<*>} [params] An empty array
* @param {Function} [cb] A function with an error object as the first argument and a boolean
* that's true when the client is listening and false when it's not as the second argument
*/
@@ -45,7 +45,7 @@ class Net {
/**
* Returns number of peers currently connected to the client
- * @param {Array<>} [params] An empty array
+ * @param {Array<*>} [params] An empty array
* @param {Function} [cb] A function with an error object as the first argument and the
* number of peers connected to the client as the second argument
*/
diff --git a/lib/rpc/modules/web3.js b/lib/rpc/modules/web3.js
index e9d5c22..02e903d 100644
--- a/lib/rpc/modules/web3.js
+++ b/lib/rpc/modules/web3.js
@@ -24,7 +24,7 @@ class Web3 {
/**
* Returns the current client version
- * @param {Array<>} [params] An empty array
+ * @param {Array<*>} [params] An empty array
* @param {Function} [cb] A function with an error object as the first argument and the
* client version as the second argument
*/