-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Daemon RPC: high start_height ok in /getblocks.bin [v0.18] #9902
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
base: release-v0.18
Are you sure you want to change the base?
Daemon RPC: high start_height ok in /getblocks.bin [v0.18] #9902
Conversation
Behavior before: when start_height > chain tip, response fails Behavior after: when req.high_height_ok is true && req.start_height > chain tip, server rerturns a successful response that includes chain height
here is an alternative to this that would require just two line changes: that means that behavior of the RPC stays the same, but it doesn't block clients anymore. the benefit of this solution is that it does not add technical debt in the form of yet another option and removes unnecessary code. It would also enable the deletion of the add_host_fail method. In essence the solution is to just revert the commit that introduced this weird rpc client banning behavior on http 500. |
This idea was also aiming to solve for the case that the client still wants to know the daemon's height without another round trip to the daemon (not just get rid of the ban) |
In theory it's not strictly necessary for the case described here, since there should still be one successful response (that we can use to explain the other RPC failures). But a success response that includes the height does make the response simpler to manage. |
true. KV_SERIALIZE_OPT(high_height_ok, false) // default false maintains backwards compatibility for clients that relied on failure on high height It is good to be conservative, but at the same time: what is the worst case we are trying to avoid? In this case it would be that syncing might get stuck? But the success response will contain a new daemon height, it will pick that up and then sync towards that. The other part is removing add_host_fail. But maybe that can be a separate PR. |
An example: a dev using the current API might expect a failure response when they provide too high of a height to e.g. know when to stop fetching blocks. Their software could end up infinite looping, or totally breaking, if the endpoint returns a success response instead. Maybe we can claim that would be the incorrect way of knowing when to stop fetching blocks. But I can imagine someone being peeved with their software breaking due to a change to the endpoint. If we were to make the breaking change and bump the RPC major version, then older clients would not be able to use the updated daemon. Thus, I leaned conservative on this with the (obviously unfortunate) new request field. |
Actuaaaaally, since current behavior is to ban clients requesting a high height, there's no way anyone is justifiably relying on that behavior... I think we're justified in getting rid of this |
Since current behavior on release is to ban clients with too high a height included in the request, it seems reasonably justified to modify that behavior to instead return a successful response that includes the chain height and top block hash.
This PR: If the client requests a
start_height
> current chain tip, then the daemon returns a successful response that includes the chain's height.Current behavior on release is to ban a client that requests such a height.
This PR's behavior is useful both in this FCMP++ integration PR's approach to syncing that simplifies wallet refresh while minimizing data downloaded by the client, and in the async scanner.
#9382
#10025