-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: route to nodes even if slightly behind max height #68
Conversation
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.
I love how easy this change is
internal/route/node_filter.go
Outdated
@@ -6,6 +6,10 @@ import ( | |||
"github.com/satsuma-data/node-gateway/internal/metadata" | |||
) | |||
|
|||
const ( | |||
MaxAllowedBlocksBehindHead = 10 |
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 we want to guarantee clients will have access to data no staler than some amount of time, we probably want this configurable because of how different the block production times are. The plan is to run one gateway per chain right now, so having this configurable globally would be ok.
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.
Done - added a new Routing
session of the config so that I can pass that into the filter factory and have it be responsible for that part of the config (e.g. handling defaults).
dcbd3b7
to
cf1b56a
Compare
cf1b56a
to
706260f
Compare
706260f
to
4b3c1ff
Compare
Description
We want to be able to tolerate some lag in certain situations. For example, we might want to favour our own node over a node provider even if we're slightly behind head. This PR keeps routing to nodes as long as they are within 10 blocks of the max height.
Type of change
How Has This Been Tested?
Added unit tests for new filter.