-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Shortcut SF condition when canon known #1401
Conversation
Rather than just the canon chain.
if self.chain_info().best_block_number > 1_761_000 { | ||
return self.block_header(BlockID::Number(1_760_000)).map(|header| HeaderView::new(&header).gas_limit()); | ||
} | ||
// otherwise check according to `chain_hash`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just?
fn dao_rescue_block_gas_limit(&self) -> Option<U256> {
self.block_header(BlockID::Number(1_760_000)).map(|header| HeaderView::new(&header).gas_limit())
}
the code below is doing exactly the same thing. It's also less efficient and more complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code will look only in canon chain. The code below is looking for the block in other possible chains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this makes the pr code invalid, cause it cares about the canon chain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? The first part is shortcutting if canon is more then 1000 blocks after the trigger. The code below will be run between 1_760_000
and 1_761_000
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. 1_761_000
looks almost the same as 1_760_000
. It would be good to make constants from these numbers.
the code will be removed in 2 days; i think we all understand what it does now :) |
builds & tests fine locally. |
No description provided.