Skip to content

Commit

Permalink
fix: adapt multi-get calls
Browse files Browse the repository at this point in the history
They don't need a vec since MystenLabs/mysten-infra#14 was solved.
  • Loading branch information
huitseeker committed Mar 22, 2022
1 parent 40b870d commit 00a894e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 2 additions & 4 deletions sui_core/src/authority/authority_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,9 @@ impl<const ALL_OBJ_VER: bool> SuiDataStore<ALL_OBJ_VER> {
transaction_digest: &TransactionDigest,
object_ids: impl Iterator<Item = &'a ObjectID>,
) -> Result<Vec<Option<SequenceNumber>>, SuiError> {
let keys: Vec<_> = object_ids
.map(|objid| (*transaction_digest, *objid))
.collect();
let keys = object_ids.map(|objid| (*transaction_digest, *objid));

self.sequenced.multi_get(&keys[..]).map_err(SuiError::from)
self.sequenced.multi_get(keys).map_err(SuiError::from)
}

/// Read a lock for a specific (transaction, shared object) pair.
Expand Down
13 changes: 5 additions & 8 deletions sui_core/src/gateway_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::{authority_aggregator::AuthorityAggregator, authority_client::AuthorityAPI};
use async_trait::async_trait;
use futures::future;
use itertools::Itertools;

use move_core_types::identifier::Identifier;
use move_core_types::language_storage::TypeTag;
use move_core_types::value::MoveStructLayout;
Expand Down Expand Up @@ -410,13 +410,10 @@ impl AccountState {
/// The caller has to explicitly find which objects are locked
/// TODO: always return true for immutable objects https://github.com/MystenLabs/sui/issues/305
fn can_lock_or_unlock(&self, transaction: &Transaction) -> Result<bool, SuiError> {
let iter_matches = self.store.pending_transactions.multi_get(
&transaction
.input_objects()?
.iter()
.map(|q| q.object_id())
.collect_vec(),
)?;
let iter_matches = self
.store
.pending_transactions
.multi_get(transaction.input_objects()?.iter().map(|q| q.object_id()))?;
if iter_matches.into_iter().any(|match_for_transaction| {
matches!(match_for_transaction,
// If we find any transaction that isn't the given transaction, we cannot proceed
Expand Down

0 comments on commit 00a894e

Please sign in to comment.