-
Notifications
You must be signed in to change notification settings - Fork 197
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
Refactor transaction account unlocking #103
Conversation
7445684
to
e702fa6
Compare
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.
Neat!
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.
lgtm
@@ -51,7 +51,14 @@ impl<'a, 'b> TransactionBatch<'a, 'b> { | |||
// Unlock all locked accounts in destructor. | |||
impl<'a, 'b> Drop for TransactionBatch<'a, 'b> { | |||
fn drop(&mut self) { | |||
self.bank.unlock_accounts(self) | |||
if self.needs_unlock() { | |||
self.set_needs_unlock(false); |
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.
I realize we had this previously, but I'm struggling to think why this is necessary. We're in middle of dropping this batch, so it won't get dropped and attempt unlock again, right?
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.
Yup, it's really not necessary to set to false
here
refactor: unlock accounts
Problem
Current transaction account unlocking APIs aren't ideal for implementing partial transaction batch unlocking. Partial unlocking is needed for solana-labs#34825 by implementing a process of
Summary of Changes
Accounts::unlock_accounts
andBank::unlock_accounts
to operate over a zipped iterator of transactions and lock results so that it's easier to implement a partial unlock of a transaction batch.is_empty
check insideAccounts::unlock_accounts
to avoid taking the accounts lock if it's not neededFixes #