From e7948f86962de7eee2a000cf095278c6e4876c46 Mon Sep 17 00:00:00 2001 From: keroro Date: Mon, 7 Nov 2022 00:02:47 +0800 Subject: [PATCH] block_producer.rs comment --- crates/block-producer/src/block_producer.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/block-producer/src/block_producer.rs b/crates/block-producer/src/block_producer.rs index 246d0259a..1bf7a5833 100644 --- a/crates/block-producer/src/block_producer.rs +++ b/crates/block-producer/src/block_producer.rs @@ -257,6 +257,10 @@ impl BlockProducer { // header_deps, used for obtaining l1 time in the state-validator-script let block_number = block.raw().number().unpack(); if 2 <= rollup_context.determine_global_state_version(block_number) { + // Recover the l1_confirmed_header based on l1_confimed_timestamp. + // The l1_confirmed_header is referenced when producing l2block and GlobalState. + // + // The block producer would reference confirmed headers to avoid L1 reorg issue. let finality_as_duration = rollup_context.rollup_config.finality_as_duration(); let last_finalized_timestamp = match Timepoint::from_full_value( global_state.last_finalized_block_number().unpack(), @@ -277,6 +281,7 @@ impl BlockProducer { l1_confirmed_timestamp, block_number ) }); + tx_skeleton .header_deps_mut() .push(ckb_types::prelude::Unpack::unpack(&l1_confirmed_header.hash()).pack());