Skip to content

Commit

Permalink
block_producer.rs comment
Browse files Browse the repository at this point in the history
  • Loading branch information
keroro520 committed Nov 6, 2022
1 parent cba5aef commit e7948f8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/block-producer/src/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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());
Expand Down

0 comments on commit e7948f8

Please sign in to comment.