Skip to content

Add missing return fields in v22 to v29 #272

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

Merged
merged 15 commits into from
Jun 26, 2025

Conversation

jamillambert
Copy link
Collaborator

Some of the types in v22 to v29 had missing return fields. All missing fields that are shown by adding #[serde(deny_unknown_fields)] to the structs in all versions have now been added.

Minor reorganisation of the code, in separate commits which describe what was done.

Add all of the missing fields update the models, error, into function and reexports accordingly. Redefinitions of the types, error and into functions are modified copies of the most recent version of the RPC that had fields added.

Run the formatter in a separate commit to make the changes to the reexports easier to review.

Returned field `type` from `decodescript` is not optional for v17 to
v29.

Remove the Option and make it a String.
`decodescript` had missing fields in v22 and v23.

Redefine the types with the missing fields.  Add the fields to the model
and update the into functions.
Update the reexports.
The core help gives a list in alphabetical order.

Change the list here to match and make reading it easier. Reorder only
no other changes.
`logging` had missing fields in v23, v25 and v26. And one field removed
in v28.

Redefine the types with the missing fields.
Update the reexports.
`ScriptPubKey` had a missing field in v23.

Add the field as an Option to the definition.
In preparation for further changes move the wallet module files in v19
and v26 to a subdirectory. No other changes.
Create an into module and move the into functions there. Code move only.
`gettransaction` had missing fields in v19, v20, v23, v24, v26 and v28.

Add the new LastProcessedBlock type.

Redefine the types with the missing fields.  Add the fields to the model
and update the into functions.
Update the reexports.
There is a missing return field in v26 `gettxoutsetinfo`.

Add the missing field to the existing redefinition of the type in v26.
Update the model and into functions.
There are missing return fields in v25 `getblockstats`.

Redefine the type for v25 with the missing fields.
Update the model and into functions.
There are missing return fields in v24 `listunspent`.

Redefine the type for v24 with the missing fields.
Update the model and into functions.
Move the into_model functions from mod.rs into the `into` module.  Code
move only, no other changes.
Add a error type for GetBalances.
There is a missing return field in v26 `getbalances`.

Redefine the type for v26 with the missing fields.
Update the model, error, into functions and reexports.
Reordering the rexports only. No other changes.
@jamillambert
Copy link
Collaborator Author

Sorry this was a big one. It's the last of it's kind though, there should be no more missing fields for any version and we can then add the #[serde(deny_unknown_fields)] to everything to close issue #241.

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 33e63ad

@tcharding
Copy link
Member

Damn bro, you have come along way in the last six months. The patch set construction in this PR is clean as. Well done man.

and we can then add the #[serde(deny_unknown_fields)] to everything to close issue #241.

I'm looking forward to seeing this!

@tcharding tcharding merged commit 7e341c8 into rust-bitcoin:master Jun 26, 2025
29 checks passed
tcharding added a commit that referenced this pull request Jun 28, 2025
…d for

16ae504 Add serde(deny_unknown_fileds) (Jamil Lambert, PhD)
6dcf4c3 Fix comment and derive order for method (Jamil Lambert, PhD)
e84d8e9 Reorder derives to be the same (Jamil Lambert, PhD)

Pull request description:

  If there are missing return fields in the types structs the integration tests still pass.

  All of the missing fields have been added in #243, #251, #255, #267 and #272.

  The solution suggested in issue #241 is adding `#[serde(deny_unknown_fields)]` to each struct which makes the test fail if there are fields returned that are not in the struct.

  - First two patches: do a small code reorganisation to make sure the third patch that uses a search and replace catches all cases.
  - Third patch: add `#[serde(deny_unknown_fields)]` to all structs in `types` that derive `Serialize` and therefore use serde. Using a search and replace.

  Closes #241

ACKs for top commit:
  tcharding:
    ACK 16ae504

Tree-SHA512: 5e898edb3b1ce9a05cd3c576b71caf9f96a2cd0f29660a480f6d5775d682fb277665c013cb52c986d90d37f36c5bc320139d351ffc29e1a755d72d11ad185c4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants