mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
Enrich the sync log on handling the block request (#11747)
Add more info to the log to help debug the issue like https://github.com/paritytech/substrate/issues/11732. Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -226,16 +226,13 @@ where
|
|||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
target: LOG_TARGET,
|
target: LOG_TARGET,
|
||||||
"Handling block request from {}: Starting at `{:?}` with maximum blocks \
|
"Handling block request from {peer}: Starting at `{from_block_id:?}` with \
|
||||||
of `{}`, direction `{:?}` and attributes `{:?}`.",
|
maximum blocks of `{max_blocks}`, reputation_change: `{reputation_change:?}`, \
|
||||||
peer,
|
small_request `{small_request:?}`, direction `{direction:?}` and \
|
||||||
from_block_id,
|
attributes `{attributes:?}`.",
|
||||||
max_blocks,
|
|
||||||
direction,
|
|
||||||
attributes,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let result = if reputation_change.is_none() || small_request {
|
let maybe_block_response = if reputation_change.is_none() || small_request {
|
||||||
let block_response = self.get_block_response(
|
let block_response = self.get_block_response(
|
||||||
attributes,
|
attributes,
|
||||||
from_block_id,
|
from_block_id,
|
||||||
@@ -259,9 +256,22 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some(block_response)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
debug!(
|
||||||
|
target: LOG_TARGET,
|
||||||
|
"Sending result of block request from {peer} starting at `{from_block_id:?}`: \
|
||||||
|
blocks: {:?}, data: {:?}",
|
||||||
|
maybe_block_response.as_ref().map(|res| res.blocks.len()),
|
||||||
|
maybe_block_response.as_ref().map(|res| res.encoded_len()),
|
||||||
|
);
|
||||||
|
|
||||||
|
let result = if let Some(block_response) = maybe_block_response {
|
||||||
let mut data = Vec::with_capacity(block_response.encoded_len());
|
let mut data = Vec::with_capacity(block_response.encoded_len());
|
||||||
block_response.encode(&mut data)?;
|
block_response.encode(&mut data)?;
|
||||||
|
|
||||||
Ok(data)
|
Ok(data)
|
||||||
} else {
|
} else {
|
||||||
Err(())
|
Err(())
|
||||||
|
|||||||
Reference in New Issue
Block a user