-
Notifications
You must be signed in to change notification settings - Fork 49
[types] Add completed field to ScanBlocksStart return type
#477
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.
It would be good to add an assert to the existing test that completed is returned for v26 and later. I checked the test for v26 and completed is true.
46f8815 to
a9d895a
Compare
|
Also included testing assert to ensure the completed field presence is verified from v26 onward. |
0c2f508 to
39dfa65
Compare
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 39dfa65
| { | ||
| assert!(json.completed); | ||
| } | ||
| } |
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.
Perhaps this is better?
let model: Result<mtype::ScanBlocksStart, ScanBlocksStartError> = json.into_model();
let model = model.unwrap();
let _: Option<ScanBlocksStatus> = node.client.scan_blocks_status().expect("scanblocks status");
let _: ScanBlocksAbort = node.client.scan_blocks_abort().expect("scanblocks abort");
#[cfg(not(feature = "v25_and_below"))]
{
assert!(model.completed.is_some());
}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.
Implemented, modified the model part for lint errors.
|
Reviewed: 39dfa65 |
|
Hit wrong button. |
39dfa65 to
38e407d
Compare
integration_test/tests/blockchain.rs
Outdated
| let model: Result<mtype::ScanBlocksStart, ScanBlocksStartError> = json.into_model(); | ||
| model.unwrap(); | ||
| let model: mtype::ScanBlocksStart = json.into_model().unwrap(); | ||
| let _ = &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.
We want to keep the error type here mate. The reason we do this which is admittedly strange is to make sure we exported the error type in the right place. We had bugs before we used this pattern when we forgot to do the re-exports.
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 see, introduced back in the type with slight name deviation for the lint.
|
Reviewed 38e407d |
38e407d to
6b17258
Compare
From v26 onward, the return type of `scanblocks` RPC has an argument called `completed`, this commit adds it and handles into conversions.
6b17258 to
0f675f1
Compare
|
|
||
| #[cfg(not(feature = "v25_and_below"))] | ||
| { | ||
| assert!(_model.completed.is_some()); |
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.
Not a big fan of this _ just to get around the lint. Would it be better to assert something for all versions above this feature gated assert like assert!(model.from_height <= model.to_height)?
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 agree that we shouldn't use the under score, that has a specific meaning.
From v26 onward, the return type of
scanblocksRPC has an argument calledcompleted, this PR adds it and handles into type conversion and in previous versions changes.Partially fixes issue #474.