Skip to content

Commit

Permalink
Remove extra clone of ValidatedState
Browse files Browse the repository at this point in the history
and the TODO that goes w/ it
  • Loading branch information
tbro committed Oct 24, 2024
1 parent cea4a80 commit da1f3f4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions types/src/v0/impls/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,13 @@ impl ValidatedState {
parent_leaf: &Leaf,
l1_deposits: Vec<FeeInfo>,
) {
// TODO avoid this clone (it was just copied from original pure fn)
let mut validated_state = self.clone();
// pushing a block into merkle tree shouldn't fail
validated_state
.block_merkle_tree
self.block_merkle_tree
.push(parent_leaf.block_header().commit())
.unwrap();

for FeeInfo { account, amount } in l1_deposits.iter() {
validated_state
.fee_merkle_tree
self.fee_merkle_tree
.update_with(account, |balance| {
Some(balance.cloned().unwrap_or_default().add(*amount))
})
Expand Down

0 comments on commit da1f3f4

Please sign in to comment.