mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 06:57:58 +00:00
fixed instant finalization of genesis block on light client (#1898)
This commit is contained in:
committed by
Gav Wood
parent
90e5c5ddfb
commit
72b9df8237
@@ -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,
|
||||
};
|
||||
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user