-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: Add eth_syncing RPC method #10719
Conversation
507158f
to
5c93adf
Compare
5c93adf
to
42270a0
Compare
if ss.Stage == api.StageIdle { | ||
continue | ||
} | ||
working = i |
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.
Can you explain this? Why are looking for the index of the last non-idle one from ActiveSyncs and eg not the 1st one? (I'm not sure what ActiveSyncs represent tbh)
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 wanted to have the same logic as when calling lotus sync wait
which is done like this (see https://github.com/filecoin-project/lotus/blob/master/cli/sync.go#L286)
There is also this commit which picks the last worker in case all are idle, but it does not go in details as to why
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.
LGTM with one bug.
22cf8da
to
2bfa6b0
Compare
This commit adds eth_syncing RPC method which returns an object with data about the sync status or false.
2bfa6b0
to
2bc205e
Compare
Fixes: #10622
This PR adds
eth_syncing
as a new RPC method to Lotus. This method returns an object with data about the sync status or false.NOTE: I added
SyncApi
as dependency to theEthModule
in order to implement this functionality, not sure if there was any way around that...NOTE: If calling
eth_syncing
as soon as lotus daemon starts (within a <5 seconds) then it will result in an error (see test plan) as the syncing hasn't started properly, but I am to making it instead wait.Test plan
Started my lotus daemon on mainnet from snapshot and calling this method produces the following output depending on the sync status:
Before starting sync:
During sync:
After sync is done (according to spec
"result"
should be set to"false"
in this case):