-
Notifications
You must be signed in to change notification settings - Fork 106
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
suggestion to don't clone self
in get_block
#9044
Conversation
let get_block_header_future = if matches!(verbosity, 1 | 2) { | ||
Some(self.get_block_header(original_hash_or_height.clone(), Some(true))) | ||
} else { | ||
None | ||
}; |
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.
Optional/Nitpick/Subjective: This may actually be a little less readable, but it's tempting to use then()
here.
let get_block_header_future = if matches!(verbosity, 1 | 2) { | |
Some(self.get_block_header(original_hash_or_height.clone(), Some(true))) | |
} else { | |
None | |
}; | |
let get_block_header_future = matches!(verbosity, 1 | 2) | |
.then(|| self.get_block_header(original_hash_or_height.clone(), Some(true))); |
@conradoplg There's very little in |
Thanks! I'm not sure if this will solve the issues I'm getting implementing #9024 but I'll give it a shot there, inspired on this approoach. |
* rpc: align getblock with zcashd behaviour * Removes handling for verbosity = 3 in getblock method, adds finalorchardroot field, removes unnecessary state request. (#9008) * align final(sapling|orchard)root with zcashd behaviour * fix test * Apply suggestions from code review Co-authored-by: Alfredo Garcia <[email protected]> * restore getblock docs; remove unneeded TODOs * Update zebra-rpc/src/methods.rs Co-authored-by: Arya <[email protected]> * get rif of cloning self (#9044) --------- Co-authored-by: Arya <[email protected]> Co-authored-by: Alfredo Garcia <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Motivation
In #9006 we are cloning self in the
get_block
implementation which could bring some problems in some tests.Solution
This is an alternative to do that that @conradoplg might find useful, feel free to discard.