mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 07:31:08 +00:00
Mmr client gadget - support pallet reset (#12999)
* Remove unneeded code * Moving some code * Support pallet-mmr reset * Rename update_first_mmr_block Co-authored-by: Adrian Catangiu <adrian@parity.io> * Renamings Co-authored-by: Adrian Catangiu <adrian@parity.io>
This commit is contained in:
@@ -162,6 +162,18 @@ impl MockClient {
|
||||
client.finalize_block(hash, None).unwrap();
|
||||
}
|
||||
|
||||
pub fn undo_block_canonicalization(&self, mmr_block: &MmrBlock) {
|
||||
let mut offchain_db = self.offchain_db();
|
||||
for node in NodesUtils::right_branch_ending_in_leaf(mmr_block.leaf_idx.unwrap()) {
|
||||
let canon_key = mmr_block.get_offchain_key(node, OffchainKeyType::Canon);
|
||||
let val = offchain_db.local_storage_get(StorageKind::PERSISTENT, &canon_key).unwrap();
|
||||
offchain_db.local_storage_clear(StorageKind::PERSISTENT, &canon_key);
|
||||
|
||||
let temp_key = mmr_block.get_offchain_key(node, OffchainKeyType::Temp);
|
||||
offchain_db.local_storage_set(StorageKind::PERSISTENT, &temp_key, &val);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_offchain_storage<F>(
|
||||
&self,
|
||||
key_type: OffchainKeyType,
|
||||
|
||||
Reference in New Issue
Block a user