-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generic (smart contract) event listener #921
Conversation
3aae8ad
to
0112f43
Compare
// using an event channel, we subscribe to filter logs emmitted by the postage contract(s) | ||
// since the last block recorded that had a relevant event | ||
events := make(chan types.Log) | ||
sub, err := lis.client.SubscribeFilterLogs(ctx, query(from, lis.addrs...), events) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this means dropping support for http
and https
rpc connections as the underlying eth_subscribe
call is only avail on ws
and ipc
. (which should not be an issue, our integration tests use geth and can be switched over easily. infura also supports wss
endpoints).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise we cannot do subscription since there is no push notiffications, so what to do?
// using an event channel, we subscribe to filter logs emmitted by the postage contract(s) | ||
// since the last block recorded that had a relevant event | ||
events := make(chan types.Log) | ||
sub, err := lis.client.SubscribeFilterLogs(ctx, query(from, lis.addrs...), events) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fromBlock used to be ignored in the past (see ethereum/go-ethereum#15063). Not sure if this was fixed, will have to check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if that is the case we may need to read the historical logs to catch up
https://goethereumbook.org/event-read/
0112f43
to
ac6b283
Compare
134fa9a
to
cbd4d4a
Compare
cbd4d4a
to
97b2a15
Compare
ac6b283
to
ae024b5
Compare
closed in favor of #1099 |
The PR implements an event listener as per the appendix of https://hackmd.io/o8RGsNwZSN6IE0lkBAZCPw?both (#920)
this is a prerequisite of #922 and #934 (#896).