-
Notifications
You must be signed in to change notification settings - Fork 313
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
Faster status cache #3796
base: master
Are you sure you want to change the base?
Faster status cache #3796
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,13 +191,12 @@ impl Bank { | |
) -> Vec<TransactionCheckResult> { | ||
// Do allocation before acquiring the lock on the status cache. | ||
let mut check_results = Vec::with_capacity(sanitized_txs.len()); | ||
let rcache = self.status_cache.read().unwrap(); | ||
|
||
check_results.extend(sanitized_txs.iter().zip(lock_results).map( | ||
|(sanitized_tx, lock_result)| { | ||
let sanitized_tx = sanitized_tx.borrow(); | ||
if lock_result.is_ok() | ||
&& self.is_transaction_already_processed(sanitized_tx, &rcache) | ||
&& self.is_transaction_already_processed(sanitized_tx, &self.status_cache) | ||
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. probably don't even need to pass status cache anymore |
||
{ | ||
error_counters.already_processed += 1; | ||
return Err(TransactionError::AlreadyProcessed); | ||
|
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.
❤️