-
Notifications
You must be signed in to change notification settings - Fork 43
fix(types): use f64 for GetMiningInfo networkhashps field #440
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
deadmanoz
wants to merge
1
commit into
rust-bitcoin:master
Choose a base branch
from
deadmanoz:fix-networkhashps-type
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,19 +39,17 @@ fn mining__get_block_template__modelled() { | |
| #[test] | ||
| fn mining__get_mining_info() { | ||
| let node = Node::with_wallet(Wallet::Default, &[]); | ||
| node.fund_wallet(); | ||
|
|
||
| let json: GetMiningInfo = node.client.get_mining_info().expect("rpc"); | ||
|
|
||
| // Up to v28 (i.e., not 29_0) there is no error converting into model. | ||
| #[cfg(feature = "v28_and_below")] | ||
| let _: mtype::GetMiningInfo = json.into_model(); | ||
|
|
||
| // v29 onwards | ||
| let model: mtype::GetMiningInfo = json.into_model(); | ||
| // v29 added fields (bits, target) that can fail to parse. | ||
| #[cfg(not(feature = "v28_and_below"))] | ||
| { | ||
| let model: Result<mtype::GetMiningInfo, GetMiningInfoError> = json.into_model(); | ||
| model.unwrap(); | ||
| } | ||
| let model: mtype::GetMiningInfo = json.into_model().unwrap(); | ||
|
|
||
| assert!(model.network_hash_ps > 0.0); | ||
| } | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do what you think is best but to me it looks like the only real changes needed to this test are adding the wallet funding and adding the assertion on |
||
| #[test] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 this line with the explicit
Resulttype. The reason we do this is to ensure that we exported all the error types correctly. In the past before we did this we forgot a bunch of them.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.
FTR most of the 'weird' stuff here is for a specific reason, not always obvious. Feel free to ask about anything that looks odd. Also if anything is non-uniform them we probably made a mistake - it happens.
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.
Noted, thanks for the info