Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions core/client/db/src/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,13 @@ impl<Block> LightBlockchainStorage<Block> for LightStorage<Block>
);
transaction.put(columns::HEADER, &lookup_key, &header.encode());

if number.is_zero() {
transaction.put(columns::META, meta_keys::FINALIZED_BLOCK, &lookup_key);
let is_genesis = number.is_zero();
if is_genesis {
transaction.put(columns::META, meta_keys::GENESIS_HASH, hash.as_ref());
}

let finalized = match leaf_state {
_ if is_genesis => true,
NewBlockState::Final => true,
_ => false,
};
Expand Down Expand Up @@ -972,7 +973,7 @@ pub(crate) mod tests {
#[test]
fn test_leaves_pruned_on_finality() {
let db = LightStorage::<Block>::new_test();
let block0 = insert_final_block(&db, None, || default_header(&Default::default(), 0));
let block0 = insert_block(&db, None, || default_header(&Default::default(), 0));

let block1_a = insert_block(&db, None, || default_header(&block0, 1));
let block1_b = insert_block(&db, None, || header_with_extrinsics_root(&block0, 1, [1; 32].into()));
Expand Down