Skip to content

Commit

Permalink
cosmetic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizdave97 committed Jan 8, 2025
1 parent 312a55b commit 0987b78
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions modules/pallets/mmr/gadget/src/offchain_mmr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,13 @@ where
self.offchain_db.local_storage_set(StorageKind::PERSISTENT, &canon_key, &elem);
self.offchain_db.local_storage_clear(StorageKind::PERSISTENT, &temp_key);
// if it's a leaf node, also clear the duplicate that was added to no_op storage
if let Ok(data) = pallet_mmr::mmr::Node::<Keccak256, Leaf>::decode(&mut &*elem) {
match data {
DataOrHash::Data(leaf) => {
let pre_image = leaf.preimage();
let commitment = keccak_256(&pre_image);
let duplicate_key =
pallet_ismp::offchain::leaf_default_key(commitment.into());
self.offchain_db
.local_storage_clear(StorageKind::PERSISTENT, &duplicate_key);
},
_ => {},
}
if let Ok(DataOrHash::Data(leaf)) =
pallet_mmr::mmr::Node::<Keccak256, Leaf>::decode(&mut &*elem)
{
let pre_image = leaf.preimage();
let commitment = keccak_256(&pre_image);
let duplicate_key = pallet_ismp::offchain::leaf_default_key(commitment.into());
self.offchain_db.local_storage_clear(StorageKind::PERSISTENT, &duplicate_key);
}
debug!(
target: LOG_TARGET,
Expand Down

0 comments on commit 0987b78

Please sign in to comment.