-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
add get_account to BenchTpsClient #26068
Conversation
let account = SyncClient::get_account(self, pubkey).map_err(|err| err.into()); | ||
if let Ok(account) = account { | ||
if account.is_none() { | ||
return Err(BenchTpsError::Custom("Account was not found".to_string())); | ||
} | ||
Ok(account.unwrap()) | ||
} else { | ||
Err(account.err().unwrap()) | ||
} | ||
} |
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.
let account = SyncClient::get_account(self, pubkey).map_err(|err| err.into()); | |
if let Ok(account) = account { | |
if account.is_none() { | |
return Err(BenchTpsError::Custom("Account was not found".to_string())); | |
} | |
Ok(account.unwrap()) | |
} else { | |
Err(account.err().unwrap()) | |
} | |
} | |
SyncClient::get_account(self, pubkey) | |
.map_err(|err| err.into()) | |
.and_then(|account| account.ok_or(BenchTpsError::Custom("Account was not found".to_string()))) |
Simpler and more rust-y. (Suggestion probably needs formatting)
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.
Also, could we emulate the logic in RpcClient::get_account so we don't have to have this one-off custom error?
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.
and_then
looks cool, thanks!
937d6e1
to
dbc2661
Compare
Problem
There is no method
get_account
forBenchTpsClient
which is needed for follow up PRs adding durable nonce transactions.Summary of Changes
get_account
method