mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-13 02:33:08 +00:00
move mempool checks outside transaction check function
This commit is contained in:
parent
1ef7be0af6
commit
b1724ec235
@ -247,7 +247,6 @@ impl SignedTransaction {
|
||||
) -> SignedTransaction {
|
||||
let hash = body.hash();
|
||||
let signature: Signature = private_key.sign(&hash);
|
||||
// TODO: Implement actual signature over `hash`
|
||||
let public_key = VerifyingKey::from(&private_key);
|
||||
Self {
|
||||
body,
|
||||
|
||||
@ -78,6 +78,7 @@ impl SequencerCore {
|
||||
let tx = tx
|
||||
.into_authenticated()
|
||||
.map_err(|_| TransactionMalformationErrorKind::InvalidSignature)?;
|
||||
|
||||
let TransactionBody {
|
||||
tx_kind,
|
||||
ref execution_input,
|
||||
@ -87,13 +88,8 @@ impl SequencerCore {
|
||||
..
|
||||
} = tx.body();
|
||||
|
||||
let mempool_size = self.mempool.len();
|
||||
let tx_hash = *tx.hash();
|
||||
|
||||
if mempool_size >= self.sequencer_config.max_num_tx_in_block {
|
||||
return Err(TransactionMalformationErrorKind::MempoolFullForRound { tx: tx_hash });
|
||||
}
|
||||
|
||||
let curr_sequencer_roots = self.get_tree_roots();
|
||||
|
||||
if tx_roots != curr_sequencer_roots {
|
||||
@ -178,12 +174,19 @@ impl SequencerCore {
|
||||
|
||||
pub fn push_tx_into_mempool_pre_check(
|
||||
&mut self,
|
||||
item: SignedTransaction,
|
||||
signed_tx: SignedTransaction,
|
||||
tx_roots: [[u8; 32]; 2],
|
||||
) -> Result<(), TransactionMalformationErrorKind> {
|
||||
let item = self.transaction_pre_check(item, tx_roots)?;
|
||||
let mempool_size = self.mempool.len();
|
||||
if mempool_size >= self.sequencer_config.max_num_tx_in_block {
|
||||
return Err(TransactionMalformationErrorKind::MempoolFullForRound {
|
||||
tx: signed_tx.body.hash(),
|
||||
});
|
||||
}
|
||||
|
||||
self.mempool.push_item(item.into());
|
||||
let authenticated_tx = self.transaction_pre_check(signed_tx, tx_roots)?;
|
||||
|
||||
self.mempool.push_item(authenticated_tx.into());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user