You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// The number of headers to fetch in each request when fetching headers from peers.
84
-
constHEADER_FETCH_COUNT:u64 = 4000;
84
+
constHEADER_FETCH_COUNT:u64 = 100;
85
85
86
86
/// The size of the event channel used to broadcast events to listeners.
87
87
constEVENT_CHANNEL_SIZE:usize = 5000;
@@ -834,7 +834,7 @@ impl<
834
834
// If the received block number has a block number greater than the current head by more
835
835
// than the optimistic sync threshold, we optimistically sync the chain.
836
836
if received_block_number > current_head_number + self.config.optimistic_sync_threshold(){
837
-
tracing::debug!(target:"scroll::chain_orchestrator", ?received_block_number, ?current_head_number,"Received new block from peer with block number greater than current head by more than the optimistic sync threshold");
837
+
tracing::trace!(target:"scroll::chain_orchestrator", ?received_block_number, ?current_head_number,"Received new block from peer with block number greater than current head by more than the optimistic sync threshold");
838
838
let block_info = BlockInfo{
839
839
number: received_block_number,
840
840
hash: block_with_peer.block.header.hash_slow(),
@@ -856,10 +856,11 @@ impl<
856
856
{
857
857
// Fetch the headers for the received block until we can reconcile it with the current
if new_headers.first().expect("at least one header exists").parent_hash ==
875
876
current_head_hash
876
877
{
878
+
tracing::trace!(target:"scroll::chain_orchestrator", ?received_block_hash, ?received_block_number,"Received block from peer that extends the current head");
877
879
let chain_import = self.import_chain(new_headers, block_with_peer).await?;
let parent_hash = new_headers.front().expect("at least one header exists").parent_hash;
949
951
let parent_number = new_headers.front().expect("at least one header exists").number - 1;
950
952
let fetch_count = HEADER_FETCH_COUNT.min(parent_number - current_safe_head.number);
953
+
tracing::trace!(target:"scroll::chain_orchestrator", ?received_block_hash, ?received_block_number, ?parent_hash, ?parent_number, %current_safe_head, fetch_count,"Fetching headers to find common ancestor for fork");
tracing::trace!(target:"scroll::chain_orchestrator", ?received_block_hash, ?received_block_number, common_ancestor = ?headers[index].hash_slow(), common_ancestor_number = headers[index].number,"Found common ancestor for fork - reorging to new chain");
979
-
for header in headers.into_iter().skip(index + 1).rev(){
981
+
for header in headers.into_iter().take(index){
980
982
new_headers.push_front(header);
981
983
}
982
984
let chain_import = self.import_chain(new_headers.into(), block_with_peer).await?;
@@ -985,7 +987,7 @@ impl<
985
987
986
988
// If we did not find a common ancestor, we add all the fetched headers to the front of
0 commit comments