Skip to content

Commit

Permalink
chore(hardfork): apply review suggestions about block timestamp in since
Browse files Browse the repository at this point in the history
  • Loading branch information
yangby-cryptape committed Jun 11, 2021
1 parent 56c145e commit 30360a2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions verification/src/transaction_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,6 @@ impl<'a, DL: HeaderProvider> SinceVerifier<'a, DL> {
self.block_median_time(&parent_hash)
}

fn parent_block_time(&self, block_hash: &Byte32) -> u64 {
let (timestamp, _, _) = self.data_loader.timestamp_and_parent(block_hash);
timestamp
}

fn block_median_time(&self, block_hash: &Byte32) -> u64 {
if let Some(median_time) = self.median_timestamps_cache.borrow().peek(block_hash) {
return *median_time;
Expand Down Expand Up @@ -692,7 +687,10 @@ impl<'a, DL: HeaderProvider> SinceVerifier<'a, DL> {
let base_timestamp = if hardfork_switch
.is_block_ts_as_relative_since_start_enabled(epoch_number)
{
self.parent_block_time(&info.block_hash)
self.data_loader
.get_header(&info.block_hash)
.expect("header exist")
.timestamp()
} else {
self.parent_median_time(&info.block_hash)
};
Expand Down

0 comments on commit 30360a2

Please sign in to comment.