mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 19:41:05 +00:00
Make offchain indexing work (#7940)
* Make offchain indexing work This fixes some bugs with offchain indexing to make it actually working ;) * Fix tests * Fix browser build * Update client/db/src/offchain.rs Co-authored-by: cheme <emericchevalier.pro@gmail.com> * Remove seperation between prefix and key Co-authored-by: cheme <emericchevalier.pro@gmail.com>
This commit is contained in:
@@ -681,14 +681,12 @@ pub struct BlockImportOperation<Block: BlockT> {
|
||||
impl<Block: BlockT> BlockImportOperation<Block> {
|
||||
fn apply_offchain(&mut self, transaction: &mut Transaction<DbHash>) {
|
||||
for ((prefix, key), value_operation) in self.offchain_storage_updates.drain() {
|
||||
let key: Vec<u8> = prefix
|
||||
.into_iter()
|
||||
.chain(sp_core::sp_std::iter::once(b'/'))
|
||||
.chain(key.into_iter())
|
||||
.collect();
|
||||
let key = crate::offchain::concatenate_prefix_and_key(&prefix, &key);
|
||||
match value_operation {
|
||||
OffchainOverlayedChange::SetValue(val) => transaction.set_from_vec(columns::OFFCHAIN, &key, val),
|
||||
OffchainOverlayedChange::Remove => transaction.remove(columns::OFFCHAIN, &key),
|
||||
OffchainOverlayedChange::SetValue(val) =>
|
||||
transaction.set_from_vec(columns::OFFCHAIN, &key, val),
|
||||
OffchainOverlayedChange::Remove =>
|
||||
transaction.remove(columns::OFFCHAIN, &key),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user