mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-05 23:03:06 +00:00
avoid computing hash multiple times in transaction_pre_check
This commit is contained in:
parent
e79261a566
commit
b49f38ca4b
@ -82,11 +82,12 @@ impl SequencerCore {
|
|||||||
ref nullifier_created_hashes,
|
ref nullifier_created_hashes,
|
||||||
..
|
..
|
||||||
} = tx;
|
} = tx;
|
||||||
|
let tx_hash = tx.hash();
|
||||||
|
|
||||||
let mempool_size = self.mempool.len();
|
let mempool_size = self.mempool.len();
|
||||||
|
|
||||||
if mempool_size >= self.sequencer_config.max_num_tx_in_block {
|
if mempool_size >= self.sequencer_config.max_num_tx_in_block {
|
||||||
return Err(TransactionMalformationErrorKind::MempoolFullForRound { tx: tx.hash() });
|
return Err(TransactionMalformationErrorKind::MempoolFullForRound { tx: tx_hash });
|
||||||
}
|
}
|
||||||
|
|
||||||
let curr_sequencer_roots = self.get_tree_roots();
|
let curr_sequencer_roots = self.get_tree_roots();
|
||||||
@ -94,7 +95,7 @@ impl SequencerCore {
|
|||||||
if tx_roots != curr_sequencer_roots {
|
if tx_roots != curr_sequencer_roots {
|
||||||
return Err(
|
return Err(
|
||||||
TransactionMalformationErrorKind::ChainStateFurtherThanTransactionState {
|
TransactionMalformationErrorKind::ChainStateFurtherThanTransactionState {
|
||||||
tx: tx.hash(),
|
tx: tx_hash,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -108,7 +109,7 @@ impl SequencerCore {
|
|||||||
//Public transactions can not make private operations.
|
//Public transactions can not make private operations.
|
||||||
return Err(
|
return Err(
|
||||||
TransactionMalformationErrorKind::PublicTransactionChangedPrivateData {
|
TransactionMalformationErrorKind::PublicTransactionChangedPrivateData {
|
||||||
tx: tx.hash(),
|
tx: tx_hash,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -120,7 +121,7 @@ impl SequencerCore {
|
|||||||
//between public and private state.
|
//between public and private state.
|
||||||
return Err(
|
return Err(
|
||||||
TransactionMalformationErrorKind::PrivateTransactionChangedPublicData {
|
TransactionMalformationErrorKind::PrivateTransactionChangedPublicData {
|
||||||
tx: tx.hash(),
|
tx: tx_hash,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -129,7 +130,7 @@ impl SequencerCore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//Tree checks
|
//Tree checks
|
||||||
let tx_tree_check = self.store.pub_tx_store.get_tx(tx.hash()).is_some();
|
let tx_tree_check = self.store.pub_tx_store.get_tx(tx_hash).is_some();
|
||||||
let nullifier_tree_check = nullifier_created_hashes
|
let nullifier_tree_check = nullifier_created_hashes
|
||||||
.iter()
|
.iter()
|
||||||
.map(|nullifier_hash| {
|
.map(|nullifier_hash| {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user