-
Notifications
You must be signed in to change notification settings - Fork 319
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
transaction_status_service: remove get_account_locks_unchecked #2555
transaction_status_service: remove get_account_locks_unchecked #2555
Conversation
@@ -2868,12 +2868,11 @@ impl Blockstore { | |||
} | |||
} | |||
|
|||
pub fn write_transaction_status( | |||
pub fn write_transaction_status<'a>( |
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.
refactor of this function makes its' internal code slightly simpler
@@ -111,7 +111,6 @@ impl TransactionStatusService { | |||
rent_debits, | |||
.. | |||
} = committed_tx; | |||
let tx_account_locks = transaction.get_account_locks_unchecked(); |
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.
removing this also removes a pair of allocations
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.
In general, the code looks good to me and save some temporary allocations as you mentioned.
@CriesofCarrots - In the past, I believe we have been more cautious with adjusting pub
function in Blockstore than some other crates, as Blockstore is a little internal facing than some of the other stuff.
Do you know of anything that might be broken specifically if we adjust this, or just trying to be friendly to anyone downstream who might be using Blockstore ?
@@ -171,12 +170,18 @@ impl TransactionStatusService { | |||
.expect("Expect database write to succeed: TransactionMemos"); | |||
} | |||
|
|||
let message = transaction.message(); |
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.
nit: On line 167, we call the same function. The underlying function just returns a ref so not a big deal, but if message()
got refactored to do something more meaningful, would want to avoid duplicate work:
agave/sdk/src/transaction/sanitized.rs
Lines 164 to 166 in 094a634
pub fn message(&self) -> &SanitizedMessage { | |
&self.message | |
} |
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.
eventually message()
will go away entirely 😉 . or at least be abstracted by a trait (SVM{Transaction|Message}
?)
@steviez , I think your first sentence might be missing a word? (Is it more or less internal-facing?) |
Dang it yep, I meant as Blockstore is a little more external
👍 |
Problem
validate_account_locks
function got pulled intoaccount_locks
fromsdk
get_account_locks
andget_account_locks_unchecked
will be deprecatedget_account_locks_unchecked
Summary of Changes
get_account_locks_unchecked
with more direct accessblockstore::write_transaction_status
to take a single iterator (simplifies code)Fixes #