Skip to content

Commit

Permalink
feat(mempool): implement commit_block method
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadNassar1 committed Jun 5, 2024
1 parent d4c80f0 commit a3cd33b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions crates/mempool/src/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,24 @@ impl Mempool {
pub fn commit_block(
&mut self,
_block_number: u64,
_txs_in_block: &[TransactionHash],
_state_changes: HashMap<ContractAddress, AccountState>,
txs_in_block: &[TransactionHash],
state_changes: HashMap<ContractAddress, AccountState>,
) -> MempoolResult<()> {
todo!()
for tx_hash in txs_in_block {
self.tx_store.remove(tx_hash)?;
self.staging.remove(tx_hash)?;
}

for (contract_address, account_state) in state_changes {
self.state.insert(contract_address, account_state);
}

for tx_hash in self.staging.keys() {
let tx = self.tx_store.get(tx_hash)?.clone();
self.txs_queue.push(tx.into());
}

Ok(())
}
}

Expand Down

0 comments on commit a3cd33b

Please sign in to comment.