Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(core): LIT-2560 - Refactor connect() logic
- Ensure network sync is a mostly atomic operation - don't write node properties to client until handshakes complete - Ensure multiple calls to the same core instance's `connect()` method are coalesced into one handshake operation - Await operations inside of `connect()`, so that failures bubble up to the caller and they can react appropriately - Refactor `listenForNewEpoch()` to track staking contract listener in a way that allows for disconnection later and ensure one-and-only-one listener is ever attached - Add `disconnect()` method that clears all intervals to allow consumers to shut down gracefully - Make `networkSyncInterval` explicitly private (use `disconnect()`!) - Fix a variety of incorrect types - Replace 500ms polling setInterval that compared length of `serverKeys` and `config.bootstrapUrls` with Promise.race() for timeout condition - JSDocs and clearer context in error messages
- Loading branch information