Skip to content

Commit

Permalink
Fix updating LatestExecutionState
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Mar 13, 2024
1 parent ef5cd64 commit 6d8536d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions bridges/snowbridge/pallets/ethereum-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,15 @@ pub mod pallet {
block_number
);

LatestExecutionState::<T>::mutate(|s| {
s.beacon_block_root = beacon_block_root;
s.beacon_slot = beacon_slot;
s.block_hash = block_hash;
s.block_number = block_number;
});

let latest_execution_state = LatestExecutionState::<T>::get();
if beacon_slot > latest_execution_state.beacon_slot {
LatestExecutionState::<T>::mutate(|s| {
s.beacon_block_root = beacon_block_root;
s.beacon_slot = beacon_slot;
s.block_hash = block_hash;
s.block_number = block_number;
});
}
Self::deposit_event(Event::ExecutionHeaderImported { block_hash, block_number });
}

Expand Down

0 comments on commit 6d8536d

Please sign in to comment.