go-ethereum
go-ethereum copied to clipboard
eth/filters: subscribe history logs
This is the second part of #15063
I have some misgivings about how we handle block ranges right now. IMO block ranges specifically for the live mode are not necessary. I.e. when you subscribe you get the logs for all new blocks. To make my case web3.js only lets you specify FromBlock (no ToBlock) and ethers.js doesn't support any of those parameters. These are 2 of the biggest web3 libraries.
My suggestion is we can simplify this greatly by: only allowing FromBlock
and only for specifying historical blocks. I.e. FromBlock
should be either a number below head block or safe
or finalized
. Later on we can allow ToBlock
(for historical range queries).
@s1na lgtm, and as we discussed offline, seems we have more work to do, I'll post them here(in case I forget).
- [ ] support block range subscription;
- [ ] support server active close connection;
I like @s1na's idea to not allow toBlock
for subscription queries. The problem with using our subscription model is that there is no way for the server to signal the end of a subscription. We can fix that by changing how subscriptions work, but I think that will be a lot of work for everyone to support. Let's try the simple solution for now.
why not merge it ?
why not merge it ?
@karalabe @rjl493456442