Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Make a simple JSONRPC call before pubsub #61

Open
amaury1093 opened this issue Nov 29, 2018 · 1 comment
Open

Make a simple JSONRPC call before pubsub #61

amaury1093 opened this issue Nov 29, 2018 · 1 comment

Comments

@amaury1093
Copy link
Collaborator

blockNumber$() is based on onEveryBlock$, which does a pubsub eth_subscribe('newHeads'). However, when we do blockNumber$().subscribe(), we might not get the latest block immediately, and need to wait for the next received block (can take up to 15s on mainnet).

A solution would be to make a JSONRPC call first, then do the pubsub subscribe.

Note: we were using parity_subscribe('eth_blockNumber') before, and that one returned immediately the latest block it had.

Note 2: do this on newHeads and on syncing pubsubs.

@axelchalon
Copy link
Contributor

axelchalon commented Mar 4, 2019

I imagine this could also be fixed upstream in the node, i.e. emit latest value (if available) on pubsub subscription

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants