Skip to content

Implement version specific types for status 'omitted' methods #115

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

Open
tcharding opened this issue Apr 4, 2025 · 0 comments · May be fixed by #116
Open

Implement version specific types for status 'omitted' methods #115

tcharding opened this issue Apr 4, 2025 · 0 comments · May be fixed by #116

Comments

@tcharding
Copy link
Member

Currently we have a status 'omitted' that was meant to imply that we intentionally omitted adding a type. For example if method returns a std lib type

$ bt17 help pruneblockchain
pruneblockchain

Arguments:
1. "height"       (numeric, required) The block height to prune up to. May be set to a discrete height, or a unix timestamp
                  to prune blocks whose block time is at least 2 hours older than the provided timestamp.

Result:
n    (numeric) Height of the last block pruned.

This has the problem that later versions of the method might change and we will not catch it.

It would be better to add a version specific type, implement in the client, and an integration test that calls the method. Even for null, which is currently does as follows:

                match self.call("submitblock", &[into_json(hex)?]) {
                    Ok(serde_json::Value::Null) => Ok(()),
                    Ok(res) => Err(Error::Returned(res.to_string())),
                    Err(err) => Err(err.into()),
                }

Note that doing this also requires updating the method in verify (e.g., verify::metho::v17) to use Method::new_no_model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant