Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar committed Jan 19, 2022
1 parent fe63346 commit fc2f3a5
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions client/db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,14 +1337,18 @@ impl<Block: BlockT> Backend<Block> {
} else {
debug!(target: "db", "Commit: ignored incorrect index.");
}
}
},
IndexOperation::Renew { .. } => {
debug!(target: "db", "Commit: ignored indexed data renew.");
}
},
}
}
if !hashes.is_empty() {
transaction.set_from_vec(columns::TRANSACTION, &lookup_key, hashes.encode());
transaction.set_from_vec(
columns::TRANSACTION,
&lookup_key,
hashes.encode(),
);
}
},
TransactionStorageMode::StorageChain => {
Expand Down Expand Up @@ -1734,16 +1738,22 @@ impl<Block: BlockT> Backend<Block> {
)?;
match self.transaction_storage {
TransactionStorageMode::BlockBody => {
if let Some(hashes) = read_db(&*self.storage.db, columns::KEY_LOOKUP, columns::TRANSACTION, id)? {
if let Some(hashes) = read_db(
&*self.storage.db,
columns::KEY_LOOKUP,
columns::TRANSACTION,
id,
)? {
match Vec::<DbHash>::decode(&mut &hashes[..]) {
Ok(hashes) => for hash in hashes {
transaction.release(columns::TRANSACTION, hash);
}
Ok(hashes) =>
for hash in hashes {
transaction.release(columns::TRANSACTION, hash);
},
Err(err) =>
return Err(sp_blockchain::Error::Backend(format!(
"Error decoding indexed hash list: {}",
err
))),
))),
}
utils::remove_from_db(
transaction,
Expand Down Expand Up @@ -3226,16 +3236,8 @@ pub(crate) mod tests {
assert_eq!(bc.indexed_transaction(&x1_hash).unwrap().unwrap(), &x1[1..]);

// Push one more blocks and make sure block is pruned and transaction index is cleared.
let finalized = insert_block(
&backend,
1,
hash,
None,
Default::default(),
vec![],
None,
)
.unwrap();
let finalized =
insert_block(&backend, 1, hash, None, Default::default(), vec![], None).unwrap();
backend.finalize_block(BlockId::Number(1), None).unwrap();
assert_eq!(bc.body(BlockId::Number(0)).unwrap(), None);
assert_eq!(bc.indexed_transaction(&x0_hash).unwrap(), None);
Expand Down

0 comments on commit fc2f3a5

Please sign in to comment.