-
Notifications
You must be signed in to change notification settings - Fork 50
Avoid concrete rust-bitcoin type in version-specific GetOrphanTxs struct #490
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: master
Are you sure you want to change the base?
Conversation
jamillambert
left a comment
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.
ACK 1733130
|
Mad, thanks man. Can we use our funky explicit error style in the integration test to check all the re-exports are good? In let model_v0: Result<mtype::GetOrphanTxs, GetOrphanTxsError> = json_v0.into_model();
let model_v0 = model_v0.unwrap(); |
types/src/v29/hidden/error.rs
Outdated
| /// Error when converting a `GetOrphanTxs` type into the model type. | ||
| #[derive(Debug)] | ||
| pub enum GetOrphanTxsError { | ||
| /// Conversion of the transaction `txid` field failed. |
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.
Since this error is used in multiple places and there isn't always a txid field perhaps something like this?
/// Conversion of a `txid` from the orphanage failed.
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 that isn't too cute for your likeing.
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.
used that. I lazily just copy and pasted from GetOrphanTxsVerboseOneEntryError before.
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.
Thanks man. I figured as much. By convention the display error message matches the doc comment. Also you missed the v30 one. Sorry to be a bother.
|
Thanks for coming back and picking this up mate, appreciate the work. |
A concrete rust-bitcoin type was added to the version-specific `GetOrphanTxs` struct during rust-bitcoin#435. This is corrected by using a list of strings and converting to the model type via `into_model`. Affects v29 and v30. Also, use the explicit error in the itegration tests to check that the re-exports are good. Fixes rust-bitcoin#484
1733130 to
7a59cff
Compare
|
Addressed #490 (comment)! |
| // use explicit errors here to check that the re-exports are good | ||
| let model_v0: Result<mtype::GetOrphanTxs, GetOrphanTxsError> = json_v0.into_model(); | ||
| let model_v1: Result<mtype::GetOrphanTxsVerboseOne, GetOrphanTxsVerboseOneEntryError> = json_v1.into_model(); | ||
| let model_v2: Result<mtype::GetOrphanTxsVerboseTwo, GetOrphanTxsVerboseTwoEntryError> = json_v2.into_model(); |
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.
does the formatting job also check the integration test? At least locally that should have been split over multiple lines
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.
Currently its a naive cargo fmt --all -- --check so only workspace crates get hit. integration_test and verify are excluded.
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.
Raised #495
A concrete rust-bitcoin type was added to the version-specific
GetOrphanTxsstruct during #435. This is corrected by using a list of strings and converting to the model type viainto_model.Affects v29 and v30.
Fixes #484